public CreditCardDetailPage(CustomerCreditCardTokenViewModel card) { InitializeComponent(); BindingContext = _vm = new CreditCardDetailPageViewModel(card) { RootGrid = root }; }
public CreditCardDetailPageViewModel(CustomerCreditCardTokenViewModel card) { CountryList = new ObservableCollection <KeyValuePair <string, string> > { new KeyValuePair <string, string>("us", "United States"), new KeyValuePair <string, string>("ca", "Canada"), }; SelectedCountry = _countryList[0]; Card = card; CloseCommand = new AsyncDelegateCommand(OnClose); SaveCommand = new AsyncDelegateCommand(OnSave); }
private async Task OnDelete(CustomerCreditCardTokenViewModel selectedCreditCard) { try { if (IsBusy) { return; } IsBusy = true; var response = await Alert.ShowMessageConfirmation( string.Format(nameof(AppResources.AreYouSureYouWantToDeleteCreditCard).Translate(), selectedCreditCard.FriendlyName), null, nameof(AppResources.Yes).Translate(), nameof(AppResources.No).Translate()); if (!response) { return; } DeleteCustomerCreditCardToken context = new DeleteCustomerCreditCardToken { CreditCardTokenId = selectedCreditCard.TokenId }; var result = await Api.DeleteAppUserCreditCardToken(context); if (!result.Successful.GetValueOrDefault()) { await Alert.DisplayApiCallError(result.ExceptionMessage, result.ValidationErrors, nameof(AppResources.ServerError)); return; } await Load(); } catch (Exception e) { await Alert.DisplayError(e); } finally { IsBusy = false; } }
private async Task OnOpen(CustomerCreditCardTokenViewModel selectedCreditCard) { try { if (IsBusy) { return; } IsBusy = true; await Nav.NavigateTo(new PipelinePaymentCCEditPage(selectedCreditCard)); } catch (Exception e) { await Alert.DisplayError(e); } finally { IsBusy = false; } }
public PipelinePaymentCCEditPage(CustomerCreditCardTokenViewModel selectedCreditCard) { InitializeComponent(); BindingContext = _vm = new PipelinePaymentCCEditPageViewModel(selectedCreditCard); }