コード例 #1
0
        //displays the main menu and asks for input
        public void DisplayMainMenu(List <Droid> droid, DroidCollection droidCollection)
        {
            bool quitMain = false;

            do
            {
                Console.WriteLine("Welcome to Droid manager");
                Console.WriteLine("Enter the number of the desired choice");
                Console.WriteLine("1.Add a Droid");
                Console.WriteLine("2.Print the list of Droids");
                Console.WriteLine("3.Exit");
                Console.Write("Select an option: ");
                string optionSelection = Console.ReadLine();
                if (optionSelection == "1")
                {
                    addDroidUI(droid, droidCollection);
                }
                else if (optionSelection == "2")
                {
                    droidCollection.printDroidList(droid);
                }
                else if (optionSelection == "3")
                {
                    Console.WriteLine("Goodbye");
                    Environment.Exit(0);
                }
            } while (quitMain != true);
        }
コード例 #2
0
        //displays the main menu and asks for input
        public void DisplayMainMenu(List<Droid> droid, DroidCollection droidCollection)
        {
            bool quitMain = false;

            do
            {
                Console.WriteLine("Welcome to Droid manager");
                Console.WriteLine("Enter the number of the desired choice");
                Console.WriteLine("1.Add a Droid");
                Console.WriteLine("2.Print the list of Droids");
                Console.WriteLine("3.Exit");
                Console.Write("Select an option: ");
                string optionSelection = Console.ReadLine();
                if (optionSelection == "1")
                {
                    addDroidUI(droid, droidCollection);

                }
                else if (optionSelection == "2")
                {
                    droidCollection.printDroidList(droid);
                }
                else if (optionSelection == "3")
                {
                    Console.WriteLine("Goodbye");
                    Environment.Exit(0);
                }

            } while (quitMain != true);
        }