예제 #1
0
        private void setAnswers(Question question)
        {
            answerCount = question.answers.Length;
            if (answerCount == 2)
            {
                AnswerABox.Visibility = System.Windows.Visibility.Collapsed;
                AnswerBBox.Visibility = System.Windows.Visibility.Collapsed;
                AnswerXBox.Visibility = System.Windows.Visibility.Collapsed;
                AnswerYBox.Visibility = System.Windows.Visibility.Collapsed;
                AnswerLBox.setAnswer(AnswerBox.Answer.L);
                AnswerRBox.setAnswer(AnswerBox.Answer.R);
                AnswerLBox.setAnswerContent(question.answers[0], question.answerImages[0]);
                AnswerRBox.setAnswerContent(question.answers[1], question.answerImages[1]);

                ButtonsImage.Source = twoButtons;

                App.getInstance().xKeyboard.OnLShiftPressed += () => setAllAnswers(0);
                App.getInstance().xKeyboard.OnRShiftPressed += () => setAllAnswers(1);
            }
            else if (answerCount == 4)
            {
                AnswerABox.setAnswer(AnswerBox.Answer.A);
                AnswerBBox.setAnswer(AnswerBox.Answer.B);
                AnswerXBox.setAnswer(AnswerBox.Answer.X);
                AnswerYBox.setAnswer(AnswerBox.Answer.Y);
                AnswerABox.setAnswerContent(question.answers[0], question.answerImages[0]);
                AnswerBBox.setAnswerContent(question.answers[1], question.answerImages[1]);
                AnswerXBox.setAnswerContent(question.answers[2], question.answerImages[2]);
                AnswerYBox.setAnswerContent(question.answers[3], question.answerImages[3]);
                AnswerLBox.Visibility = System.Windows.Visibility.Collapsed;
                AnswerRBox.Visibility = System.Windows.Visibility.Collapsed;

                ButtonsImage.Source = fourButtons;

                App.getInstance().xKeyboard.OnAShiftPressed += () => setAllAnswers(0);
                App.getInstance().xKeyboard.OnBShiftPressed += () => setAllAnswers(1);
                App.getInstance().xKeyboard.OnXShiftPressed += () => setAllAnswers(2);
                App.getInstance().xKeyboard.OnYShiftPressed += () => setAllAnswers(3);
            }
            else
            {
            }
        }
        private void setAnswers(Question question)
        {
            answerCount = question.answers.Length;
            if (answerCount == 2)
            {
                AnswerABox.Visibility = System.Windows.Visibility.Collapsed;
                AnswerBBox.Visibility = System.Windows.Visibility.Collapsed;
                AnswerXBox.Visibility = System.Windows.Visibility.Collapsed;
                AnswerYBox.Visibility = System.Windows.Visibility.Collapsed;
                AnswerLBox.setAnswer(AnswerBox.Answer.L);
                AnswerRBox.setAnswer(AnswerBox.Answer.R);
                AnswerLBox.setAnswerContent(question.answers[0], question.answerImages[0]);
                AnswerRBox.setAnswerContent(question.answers[1], question.answerImages[1]);

                switch (question.correctAnswer)
                {
                case 0:
                    AnswerLBox.setCorrect();
                    AnswerRBox.setWrong();
                    break;

                case 1:
                    AnswerLBox.setWrong();
                    AnswerRBox.setCorrect();
                    break;
                }

                ButtonsImage.Source = twoButtons;
            }
            else if (answerCount == 4)
            {
                AnswerABox.setAnswer(AnswerBox.Answer.A);
                AnswerBBox.setAnswer(AnswerBox.Answer.B);
                AnswerXBox.setAnswer(AnswerBox.Answer.X);
                AnswerYBox.setAnswer(AnswerBox.Answer.Y);
                AnswerABox.setAnswerContent(question.answers[0], question.answerImages[0]);
                AnswerBBox.setAnswerContent(question.answers[1], question.answerImages[1]);
                AnswerXBox.setAnswerContent(question.answers[2], question.answerImages[2]);
                AnswerYBox.setAnswerContent(question.answers[3], question.answerImages[3]);
                AnswerLBox.Visibility = System.Windows.Visibility.Collapsed;
                AnswerRBox.Visibility = System.Windows.Visibility.Collapsed;

                switch (question.correctAnswer)
                {
                case 0:
                    AnswerABox.setCorrect();
                    AnswerBBox.setWrong();
                    AnswerXBox.setWrong();
                    AnswerYBox.setWrong();
                    break;

                case 1:
                    AnswerABox.setWrong();
                    AnswerBBox.setCorrect();
                    AnswerXBox.setWrong();
                    AnswerYBox.setWrong();
                    break;

                case 2:
                    AnswerABox.setWrong();
                    AnswerBBox.setWrong();
                    AnswerXBox.setCorrect();
                    AnswerYBox.setWrong();
                    break;

                case 3:
                    AnswerABox.setWrong();
                    AnswerBBox.setWrong();
                    AnswerXBox.setWrong();
                    AnswerYBox.setCorrect();
                    break;
                }

                ButtonsImage.Source = fourButtons;
            }
            else
            {
            }
        }