Ejemplo n.º 1
0
        public void addQuestion(Question newQuestion)
        {
            //adding new question on the end of the list
            question.Add(new Question(newQuestion.Text, newQuestion.A, newQuestion.B, newQuestion.C, newQuestion.D, newQuestion.Answer, newQuestion.DiffLvl, newQuestion.Cat));
            saveQuestionsToFile();


            Console.WriteLine("What you want to do ? ");
            Console.WriteLine("1-) Main Menu");
            Console.WriteLine("2-) Administration Panel");
            int answer = int.Parse(Console.ReadLine());

            switch (answer)
            {
            case 1:
                mainMenu object1 = new mainMenu();
                object1.displayMainMenu();
                break;

            case 2:
                administrationPanelOptions();
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
        public void getAllQuestions()
        {
            loadQuestionsFromFile();

            foreach (var questio in question)
            {
                Console.WriteLine("Category: " + questio.Cat + " Difficulty Level: " + questio.DiffLvl + "\n"
                                  + " " + questio.Text + "\n"
                                  + " " + "A) " + questio.A + " " + "B) " + questio.B + " " + "C) " + questio.C + " " + "D) " + questio.D + "\n"
                                  + "  Correct Answer: " + questio.Answer
                                  );;
            }
            Console.WriteLine("What you want to do ? ");
            Console.WriteLine("1-) Main Menu");
            Console.WriteLine("2-) Administration Panel");
            int answer = int.Parse(Console.ReadLine());

            switch (answer)
            {
            case 1:
                mainMenu object1 = new mainMenu();
                object1.displayMainMenu();
                break;

            case 2:
                administrationPanelOptions();
                break;

            default:
                break;
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            mainMenu mm = new mainMenu();

            mm.displayMainMenu();
            GameManager gm = new GameManager();


            Console.ReadLine();
        }
Ejemplo n.º 4
0
        public void administrationPanel(string userPassword)
        {
            string password = "******";

            if (password.Equals(userPassword))
            {
                Console.WriteLine("Password is correct. ");
                administrationPanelOptions();
            }
            else
            {
                mainMenu response = new mainMenu();
                response.displayMainMenu();
            }
        }
Ejemplo n.º 5
0
        public void viewAndEditQuestion()
        {
            loadQuestionsFromFile();

            foreach (var questio in question)
            {
                Console.WriteLine("Question ID: " + questio.ID + " Category: " + questio.Cat + " Difficulty Level: " + questio.DiffLvl + "\n"
                                  + " " + questio.Text + "\n"
                                  + " " + "A) " + questio.A + " " + "B) " + questio.B + " " + "C) " + questio.C + " " + "D) " + questio.D + "\n"
                                  + "  Correct Answer: " + questio.Answer
                                  );;
            }

            Console.WriteLine("Enter the id of question: ");
            int id = int.Parse(Console.ReadLine());

            foreach (var wantedQuestion in question)
            {
                if (wantedQuestion.ID == id)
                {
                    Console.WriteLine("What you want to change ?" + "\n"
                                      + "Press 1 for category: " + "\n" +
                                      "Press 2 for difficulty level: " + "\n" +
                                      "Press 3 for question body: " + "\n" +
                                      "Press 4 for A: " + "\n" +
                                      "Press 5 for B: " + "\n" +
                                      "Press 6 for C: " + "\n" +
                                      "Press 7 for D: " + "\n" +
                                      "Press 8 for Correct answer: "
                                      );
                    int choosen = int.Parse(Console.ReadLine());
                    switch (choosen)
                    {
                    case 1:
                        Console.WriteLine("Enter the new category: ");
                        wantedQuestion.Cat = Console.ReadLine();
                        break;

                    case 2:
                        Console.WriteLine("Enter the difficulty level: ");
                        wantedQuestion.DiffLvl = int.Parse(Console.ReadLine());
                        break;

                    case 3:
                        Console.WriteLine("Enter the question body: ");
                        wantedQuestion.Text = Console.ReadLine();
                        break;

                    case 4:
                        Console.WriteLine("Enter the new A: ");
                        wantedQuestion.A = Console.ReadLine();
                        break;

                    case 5:
                        Console.WriteLine("Enter the new B: ");
                        wantedQuestion.B = Console.ReadLine();
                        break;

                    case 6:
                        Console.WriteLine("Enter the new C: ");
                        wantedQuestion.C = Console.ReadLine();
                        break;

                    case 7:
                        Console.WriteLine("Enter the new D: ");
                        wantedQuestion.D = Console.ReadLine();
                        break;

                    case 8:
                        Console.WriteLine("Enter the new correct answer: ");
                        wantedQuestion.Answer = Console.ReadLine();
                        break;

                    default:
                        break;
                    }
                }
            }
            saveQuestionsToFile();

            Console.WriteLine("What you want to do ? ");
            Console.WriteLine("1-) Main Menu");
            Console.WriteLine("2-) Administration Panel");
            int answer = int.Parse(Console.ReadLine());

            switch (answer)
            {
            case 1:
                mainMenu object1 = new mainMenu();
                object1.displayMainMenu();
                break;

            case 2:
                administrationPanelOptions();
                break;

            default:
                break;
            }
        }