Exemplo n.º 1
0
        static void Main(string[] args)
        {
            GetNumbers numbers = new GetNumbers();
            MainMenu   menu    = new MainMenu();

            Console.CursorVisible = false;
            menu.Menu();
        }
Exemplo n.º 2
0
        public void Menu()
        {
            GetNumbers     numbers   = new GetNumbers();
            GenerateWinner getWinner = new GenerateWinner();
            WriteWinner    ourWinner = new WriteWinner();
            string         location  = null;

            do
            {
                Console.WriteLine("Welcome to the 42nd 'Black Watch' regiment of foots lottery bowl.\nPlease select from the list below, what you want to do.");
                Console.WriteLine("1: Select file location\n2: Generate a winner \n3: Close application");

                var input = Console.ReadKey();
                switch (input.Key)
                {
                case ConsoleKey.D1:
                    location = InsertLocation();
                    break;

                case ConsoleKey.D2:
                    if (location == null)
                    {
                        location = InsertLocation();
                    }
                    string[] lotteryNumbers = numbers.SaveNumbers(location);
                    string   winner         = getWinner.Winner(lotteryNumbers);
                    ourWinner.ShowWinner(winner);
                    continue;

                case ConsoleKey.D3:
                    Environment.Exit(0);
                    break;

                default:
                    Console.Clear();
                    continue;
                }
                Console.Clear();
            } while (true);
        }