コード例 #1
0
        private void AnswerBButton(object sender, RoutedEventArgs e)
        {
            answerB = engine.QuizzardQuestions[countQuestions].Answers[1].IsCorrect;

            if (answerB)
            {
                points += engine.QuizzardQuestions[countQuestions].Points;
                correctAnswer.Visibility = Visibility.Visible;
                wrongAnswer.Visibility   = Visibility.Collapsed;
                pPoints.Text             = points.ToString();
            }
            else
            {
                correctAnswer.Visibility = Visibility.Collapsed;
                wrongAnswer.Visibility   = Visibility.Visible;
            }

            countQuestions++;

            if (countQuestions > engine.QuizzardQuestions.Count - 1)
            {
                QuizzardEndPage endOfQuizzardTest = new QuizzardEndPage(points);
                this.NavigationService.Navigate(endOfQuizzardTest);
            }
            else
            {
                DisplayTextForQuestionAndAnswers(engine.QuizzardQuestions, countQuestions);
            }
        }
コード例 #2
0
        private void dispatcherTimer_Tick(object sender, EventArgs e)
        {
            --this.timer;
            SecondsTimer.Text = this.timer.ToString();
            if (this.timer <= 0)
            {
                this.dispatcherTimer.Stop();
                countQuestions++;

                correctAnswer.Visibility = Visibility.Collapsed;
                wrongAnswer.Visibility   = Visibility.Visible;

                if (countQuestions > engine.QuizzardQuestions.Count - 1)
                {
                    QuizzardEndPage endOfQuizzardTest = new QuizzardEndPage(points);
                    this.NavigationService.Navigate(endOfQuizzardTest);
                }
                else
                {
                    DisplayQuestionType();
                    DisplayTextForQuestionAndAnswers(engine.QuizzardQuestions, countQuestions);
                }
            }
        }