コード例 #1
0
ファイル: App.cs プロジェクト: RodRCode/RandomNameGenerator
        // Main entry point for the application
        public void Run()
        {
            FileStuff.ReadFiles(firstNamesFemale, firstNamesMale, lastNames);

            EventLoop();
            Output.ClosingMessage();
            Console.ResetColor();
        }
コード例 #2
0
ファイル: App.cs プロジェクト: RodRCode/RandomNameGenerator
        // After the names have been generated, what does the user want to do with them?
        private void NowWhat()
        {
            ConsoleMenuPainter.TextColor();
            bool finished = false;

            do
            {
                Console.Clear();
                Console.WriteLine($"OK, I've generated all {outputListOfNames.Count} names.");
                Console.WriteLine("What would you like to do?\n");
                int userChoice = Elicit.WhatNowMenu(0, 5); // the two digits are to place the menu on the x and y axis

                switch (userChoice)
                {
                case 0:
                    Console.Clear();
                    Console.WriteLine("Print the names to the screen\n");
                    PrintNames();
                    Console.WriteLine("\n\nHit enter to continue");
                    Console.ReadLine();
                    finished = true;
                    break;

                case 1:
                    Console.Clear();
                    Console.WriteLine("Print the names to a file\n");
                    FileStuff.WriteToFile(outputListOfNames, "ListOfNames.txt");
                    finished = true;
                    break;

                case 2:
                    Console.Clear();
                    Console.WriteLine("Both\n");
                    PrintNames();
                    FileStuff.WriteToFile(outputListOfNames, "ListOfNames.txt");
                    finished = true;
                    break;

                case 3:
                    Console.Clear();
                    Console.WriteLine("Quit");
                    Console.ResetColor();
                    finished = true;
                    break;

                default:
                    Console.Clear();
                    Console.WriteLine("Default case");
                    finished = true;
                    break;
                }
            } while (!finished);
        }