コード例 #1
0
ファイル: Menu.cs プロジェクト: AsafZalcman/The-Grage
        public void Run()
        {
            const bool v_NotExit = true;

            IO.PrintMsg("Hello,welcome to the .NET garage!");
            eGarageOptions userChoice;

            while (v_NotExit)
            {
                IO.ShowUserOptions();
                userChoice = getUserOption();

                try
                {
                    if (userChoice == eGarageOptions.ExitFromProgram)
                    {
                        IO.PrintMsg("Bye Bye,see you next time!");
                        break;
                    }
                    else if (userChoice == eGarageOptions.ShowLicenseNumbers)
                    {
                        string stateToFilterBy = IO.GetUserFilterChoice();
                        IO.PrintList(garage.GetLicenseNumbersOfVehicles(stateToFilterBy), "The license numbers are:");
                    }
                    else
                    {
                        needLicenseNumber(userChoice);
                    }
                }
                catch (FormatException ex)
                {
                    IO.ExceptionMsg(ex, ex.Message);
                }
                catch (ArgumentException ex)
                {
                    IO.ExceptionMsg(ex, ex.Message);
                }
                catch (ValueOutOfRangeException ex)
                {
                    IO.ExceptionMsg(ex, ex.Message);
                }
            }
        }