public void GoToWaitingForNewClient() { Person person = new Person(); MenuShift(); _mainMenu.ShowWaitingProcess(); person = JsonParser.GetRandomPerson(); if (person.haveTicket) { MenuShift(); _mainMenu.ShowWelcomeMenu(person); Console.WriteLine("Ok! You have a ticket!\nPlease go to passport control."); Thread.Sleep(3000); GoToPassportControl(person); } else { MenuShift(); _mainMenu.ShowWelcomeMenu(person); YesNoTool tool = _mainMenu.ShowBuyingTicketMenu; YesAction yesAction = delegate { Console.WriteLine("\nOK! Now you have a ticket! Please go to passport control."); }; NoAction noAction = delegate { Console.WriteLine("\nSorry you can't uses our services without any ticket. Please come back latter.\nGood Luck to you!"); }; if (EnterEscapeMenu(tool, yesAction, noAction, ConstantsValues.ErrorMessage)) { GoToPassportControl(person); } } }
public bool EnterEscapeMenu(YesNoTool tool, YesAction yes, NoAction no, string error) { ConsoleKey key = ConsoleKey.F19; while (key != ConsoleKey.Enter && key != ConsoleKey.Escape) { tool.Invoke(); _mainMenu.ShowEnterEscMenu(); Console.WriteLine(_errorMessage); key = Console.ReadKey().Key; if (key == ConsoleKey.Enter) { yes.Invoke(); Thread.Sleep(3000); return(true); } if (key == ConsoleKey.Escape) { no.Invoke(); Thread.Sleep(3000); GoBack(); } _errorMessage = error; MenuShift(); } _errorMessage = ""; return(false); }
public void GoToLuggageControl(Person person) { #region LuggageCheckSuggestion YesNoTool tool = delegate { Console.WriteLine($"Dear {person.name} {person.surname} please, let us check your luggage."); }; YesAction yseAction = delegate { Console.WriteLine("Ok! wait for a few minutes, we start to check your luggage."); }; NoAction noAction = delegate { Console.WriteLine( $"Sorry dear {person.name} {person.surname} you can't use our services without this stage of luggage control." + $"\nPlease come back later"); }; if (!EnterEscapeMenu(tool, yseAction, noAction, ConstantsValues.ErrorMessage)) { GoBack(); return; } #endregion if (person.baggageWeight > ConstantsValues.AcceptedWeight) { tool = _mainMenu.ShowOverWeightNotification; yseAction = delegate { Console.WriteLine("Ok, all right. Now we will check your luggage for a prohibited items"); }; if (!EnterEscapeMenu(tool, yseAction, noAction, ConstantsValues.ErrorMessage)) { GoBack(); return; } } if (person.prohibitedItems) { _mainMenu.ShowProhibitedItemsEnables(person); GoBack(); return; } else { } _mainMenu.ShowSuccessLuggageControlResult(); }