Пример #1
0
 private void DefaultStateAction(string input)
 {
     if (!MenuValidator.ValidateInput(input, new[] { 1, 2 }, out int validatedInput))
     {
         this.DisplayMenu();
     }
     else
     {
         this.ChangeStateBasedOnInput(validatedInput);
         this.DisplayMenu();
     }
 }
Пример #2
0
 private void SelectingStateAction(string input)
 {
     if (!MenuValidator.ValidateSelectedCell(input))
     {
         this.DisplayMenu();
     }
     else
     {
         this.currentState        = MenuState.Payment;
         this.currentItemPosition = input;
         this.DisplayMenu();
     }
 }
Пример #3
0
        private bool IsValidPaymentMethodSelected(string input)
        {
            if (MenuValidator.ValidateInput(input, new[] { 1, 2, 3, 4, 5, 6, 7 }, out int validatedInput))
            {
                if (validatedInput == 7)
                {
                    // Abort payment operation
                    this.paymentTerminal.AbortPayment();
                }

                this.paymentMethodSelection = validatedInput;
                return(true);
            }

            this.PrintOneLine($"Invalid value entered {input}!");
            return(false);
        }