示例#1
0
        public void Add(string question, string correctAnswerText, string incorrectAnswerText1, 
                                    string incorrectAnswerText2, string incorrectAnswerText3)
        {
            Answer correctAnswer = new Answer() { Text = correctAnswerText };
              Answer incorrectAnswer1 = new Answer() { Text = incorrectAnswerText1, IsCorrect = false};
              Answer incorrectAnswer2 = new Answer() { Text = incorrectAnswerText2, IsCorrect = false};
              Answer incorrectAnswer3 = new Answer() { Text = incorrectAnswerText3, IsCorrect = false};

              Card card = new Card() {Question = question,
                                   CorrectAnswer = correctAnswer,
                                    IncorrectAnswer1 = incorrectAnswer1,
                                    IncorrectAnswer2 = incorrectAnswer2,
                                    IncorrectAnswer3 = incorrectAnswer3};

            Cards.Add(card);
            WriteToJSON();
        }
        public void populateAnswerFieldsInRandomOrder()
        {
            if (_randomNumber == 0)
            {
                answer1 = randomCard.CorrectAnswer;
                txtAnswer1.Text = answer1.Text;

                answer2 = randomCard.IncorrectAnswer1;
                txtAnswer2.Text = answer2.Text;

                answer3 = randomCard.IncorrectAnswer2;
                txtAnswer3.Text = answer3.Text;

                answer4 = randomCard.IncorrectAnswer3;
                txtAnswer4.Text = answer4.Text;

            }
            else if (_randomNumber == 1)
            {
                answer2 = randomCard.CorrectAnswer;
                txtAnswer2.Text = answer2.Text;

                answer1 = randomCard.IncorrectAnswer1;
                txtAnswer1.Text = answer1.Text;

                answer3 = randomCard.IncorrectAnswer2;
                txtAnswer3.Text = answer3.Text;

                answer4 = randomCard.IncorrectAnswer3;
                txtAnswer4.Text = answer4.Text;

            }
            else if (_randomNumber == 2)
            {
                answer3 = randomCard.CorrectAnswer;
                txtAnswer3.Text = answer3.Text;

                answer1 = randomCard.IncorrectAnswer2;
                txtAnswer1.Text = answer1.Text;

                answer2 = randomCard.IncorrectAnswer3;
                txtAnswer2.Text = answer2.Text;

                answer4 = randomCard.IncorrectAnswer1;
                txtAnswer4.Text = answer4.Text;

            }
            else if (_randomNumber == 3)
            {
                answer4 = randomCard.CorrectAnswer;
                txtAnswer4.Text = answer4.Text;

                answer1 = randomCard.IncorrectAnswer1;
                txtAnswer1.Text = answer1.Text;

                answer2 = randomCard.IncorrectAnswer2;
                txtAnswer2.Text = answer2.Text;

                answer3 = randomCard.IncorrectAnswer3;
                txtAnswer3.Text = answer3.Text;
            }
        }