Пример #1
0
        static void Main(string[] args)
        {
            ConsoleInteraction.WriteLines(UserDialog.GetMenu());

            bool exit = false;

            while (!exit)
            {
                ConsoleInteraction.ShowPrompt();
                var userInputKey = ConsoleInteraction.ReadKey();

                switch (userInputKey.KeyChar)
                {
                case '0':
                    ConsoleInteraction.ShowExiting();
                    exit = true;
                    break;

                case '1':
                    CinemaGoers cinemaGoers = new CinemaGoers();

                    if (!TryGetUserInputNumParticipants(out int numParticipants))
                    {
                        ConsoleInteraction.WriteLine(UserDialog.FaultyInputMessage);
                        break;
                    }

                    cinemaGoers.Participants = AddCinemaGoers(numParticipants);
                    //cinemaGoers.Participants = DummyData.GetDummyCinemaGoers();

                    var rows = UserDialog.GetRowsCinemaGoer(cinemaGoers.Participants);
                    ConsoleInteraction.WriteLines(rows);

                    var totalRow = UserDialog.GetRowTicketsTotal(cinemaGoers.GetTotalTicketSum());
                    ConsoleInteraction.WriteLine(totalRow);

                    break;

                case '2':
                    ShowSentenceRepeatedTenTimes();
                    break;

                case '3':
                    ShowThirdWord();
                    break;

                default:
                    ConsoleInteraction.WriteLine(UserDialog.FaultyInputMessage);
                    break;
                }
            }
            ConsoleInteraction.ShowHitAnyKeyToExit();
        }