private async Task SaveAsync()
        {
            if (BillingAddressViewModel.ValidateForm())
            {
                string errorMessage = string.Empty;

                try
                {
                    await BillingAddressViewModel.ProcessFormAsync();

                    _navigationService.GoBack();
                }
                catch (ModelValidationException mvex)
                {
                    DisplayValidationErrors(mvex.ValidationResult);
                }
                catch (Exception ex)
                {
                    errorMessage = string.Format(CultureInfo.CurrentCulture, _resourceLoader.GetString("GeneralServiceErrorMessage"), Environment.NewLine, ex.Message);
                }

                if (!string.IsNullOrWhiteSpace(errorMessage))
                {
                    await _alertMessageService.ShowAsync(errorMessage, _resourceLoader.GetString("ErrorServiceUnreachable"));
                }
            }
        }
Example #2
0
        private async void GoNext()
        {
            IsShippingAddressInvalid = ShippingAddressViewModel.ValidateForm() == false;
            IsBillingAddressInvalid  = !UseSameAddressAsShipping && BillingAddressViewModel.ValidateForm() == false;
            IsPaymentMethodInvalid   = PaymentMethodViewModel.ValidateForm() == false;

            if (IsShippingAddressInvalid || IsBillingAddressInvalid || IsPaymentMethodInvalid)
            {
                return;
            }

            string errorMessage = string.Empty;

            try
            {
                await _accountService.VerifyUserAuthenticationAsync();
                await ProcessFormAsync();
            }
            catch (Exception ex)
            {
                errorMessage = string.Format(CultureInfo.CurrentCulture, _resourceLoader.GetString("GeneralServiceErrorMessage"), Environment.NewLine, ex.Message);
            }

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                await _alertMessageService.ShowAsync(errorMessage, _resourceLoader.GetString("ErrorServiceUnreachable"));
            }
        }