Exemple #1
0
        public void ProcessInput(int input)
        {
            switch (input)
            {
            case 1:
                Console.Write("Please enter the home team's ");
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("NAME");
                Console.ForegroundColor = ConsoleColor.White;

                string firstTeamName = consoleHandler.ReadString();
                Console.Write("Please enter the home team's ");
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("SCORE");
                Console.ForegroundColor = ConsoleColor.White;
                int firstTeamScore = consoleHandler.ReadInt(false);

                Console.Write("Please enter the away team's ");
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("NAME");
                Console.ForegroundColor = ConsoleColor.White;
                string secondTeamName = consoleHandler.ReadString();
                Console.Write("Please enter the away team's ");
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("SCORE");
                Console.ForegroundColor = ConsoleColor.White;
                int secondTeamScore = consoleHandler.ReadInt(false);

                Team  firstTeam  = new Team(firstTeamName, firstTeamScore);
                Team  secondTeam = new Team(secondTeamName, secondTeamScore);
                Match auxMatch   = new Match(firstTeam, secondTeam, Matches.Count);

                StartMatch(auxMatch);
                break;

            case 2:
                Console.WriteLine(GetSummary());
                Console.WriteLine("------------------------------------------------------------------------ \n");
                Console.WriteLine("Press ENTER to go back to the menu.");
                Console.Read();
                Console.Clear();
                break;

            case 3:
                Console.WriteLine("Choose the match you wish to update by typing its ID. \n");
                Console.WriteLine(GetSummary());
                Console.WriteLine("------------------------------------------------------------------------ \n");
                int id = consoleHandler.ReadInt(false);
                Console.Clear();

                Console.WriteLine("Enter the updated score of the home team.");
                int homeTeamScore = consoleHandler.ReadInt(false);
                Console.Clear();

                Console.WriteLine("Enter the updated score of the away team.");
                int awayTeamScore = consoleHandler.ReadInt(false);
                Console.Clear();

                UpdateScore(id, homeTeamScore, awayTeamScore);
                break;

            case 4:
                Console.WriteLine("Choose the match you wish to finish by týping its ID.");
                Console.WriteLine(GetSummary());
                Console.WriteLine("------------------------------------------------------------------------ \n");
                FinishMatch(consoleHandler.ReadInt(false));
                break;

            case 9:
                break;

            default:
                Console.WriteLine("Please enter a valid value.");
                break;
            }
        }