Ejemplo n.º 1
0
 public void AddQuestion(Question newQuestion)
 {
     Questions.Add(newQuestion);
     Total += newQuestion.PointValue;
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("\t\t*** ВИКТОРИНА ***\n");
            Console.Write(Resource1.Name);
            string name = Console.ReadLine();
            Menu   menu = new Menu();

            menu.PrintMenu(name);

            while (true)
            {
                int a;
                Console.Write("\nВыберите пункт из меню: ");
                int.TryParse(Console.ReadLine(), out a);
                switch (a)
                {
                case 1:
                    Console.WriteLine("Start");
                    Questions questions = new Questions();
                    questions.Test(name);
                    break;

                case 2:
                    Console.WriteLine("Past result:");
                    Past_results past = new Past_results(name);
                    past.Read();
                    break;

                case 3:
                    Console.WriteLine("Top 20:");
                    Top top = new Top();
                    top.Read();
                    break;

                case 4:
                    Console.Write(Resource1.Name);
                    name = Console.ReadLine();
                    menu.PrintMenu(name);
                    break;

                case 5:
                    bool ExitCase = false;
                    while (true)
                    {
                        Console.WriteLine(" Y/N ?");

                        string vubor = Console.ReadLine();
                        switch (vubor)
                        {
                        case "Y":
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.WriteLine("Goodbye");
                            Console.ForegroundColor = ConsoleColor.Gray;
                            return;

                        case "N":
                            Console.ForegroundColor = ConsoleColor.Green;
                            Console.WriteLine("Back");
                            ExitCase = true;
                            Console.ForegroundColor = ConsoleColor.Gray;
                            break;

                        default:
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.Write(Resource1.Povtor);
                            Console.WriteLine();
                            Console.ForegroundColor = ConsoleColor.Gray;
                            break;
                        }

                        if (ExitCase)
                        {
                            break;
                        }
                    }
                    break;

                default:
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(Resource1.Povtor);
                    Console.ForegroundColor = ConsoleColor.Gray;
                    break;
                }
            }
        }