Example #1
0
        private async Task <bool> PrevalidatePickupAndDestinationRequired(Action onValidated)
        {
            try
            {
                await _orderWorkflowService.ValidatePickupAndDestination();

                onValidated.Invoke();
            }
            catch (OrderValidationException e)
            {
                switch (e.Error)
                {
                case OrderValidationError.OpenDestinationSelection:
                    // not really an error, but we stop the command from proceeding at this point
                    return(false);

                case OrderValidationError.PickupAddressRequired:
                    ResetToInitialState.ExecuteIfPossible();
                    this.Services().Message.ShowMessage(this.Services().Localize["InvalidBookinInfoTitle"], this.Services().Localize["InvalidBookinInfo"]);
                    return(false);

                case OrderValidationError.DestinationAddressRequired:
                    ResetToInitialState.ExecuteIfPossible();
                    this.Services().Message.ShowMessage(this.Services().Localize["InvalidBookinInfoTitle"], this.Services().Localize["InvalidBookinInfoWhenDestinationIsRequired"]);
                    return(false);
                }
            }
            catch (Exception e)
            {
                Logger.LogError(e);
                ResetToInitialState.ExecuteIfPossible();
                return(false);
            }
            return(true);
        }
Example #2
0
 private async Task ValidateOrderDetails()
 {
     using (this.Services().Message.ShowProgress())
     {
         try
         {
             await Task.WhenAll(
                 _orderWorkflowService.ResetOrderSettings(),
                 ShowFareEstimateAlertDialogIfNecessary(),
                 ValidateCardOnFile(),
                 PreValidateOrder()
                 );
         }
         catch (Exception ex)
         {
             Logger.LogError(ex);
             ResetToInitialState.ExecuteIfPossible();
             return;
         }
     }
 }