コード例 #1
0
        public static void MainMenu()
        {
            //Declare and initilize loop variable
            bool mainMenuLoop = false;

            //Loop to control main menu options
            do
            {
                Console.Clear();
                Console.WriteLine(StandardMessages.DisplayMainMenu());

                //Get menu choice from user
                string menuChoice = (Console.ReadLine());

                //Use to control the selction of the main menu
                switch (menuChoice)
                {
                case "1":
                case "Start":
                    Console.Clear();
                    mainMenuLoop = true;
                    break;

                case "2":
                case "Settings":
                case "settings":
                case "S":
                case "s":
                    Console.WriteLine(StandardMessages.DisplaySettingsMenu());
                    Console.ReadLine();
                    break;

                case "3":
                case "Options":
                case "options":
                case "O":
                case "o":

                    OptionMenu();
                    break;

                case "4":
                case "Exit":
                case "exit":
                case "E":
                case "e":
                    mainMenuLoop = true;
                    System.Environment.Exit(0);
                    break;

                default:
                    Console.WriteLine(StandardMessages.InvalidSelection());
                    Console.ReadLine();
                    break;
                }
            } while (mainMenuLoop == false);
        }