Exemplo n.º 1
0
        public static async Task <QuestionWindow> CreateQuestionWindow()
        {
            QuestionWindow questionWindow = new QuestionWindow();
            QuestionPage   page           = await QuestionPage.CreateQuestionPage();

            questionWindow.QuestionFrame.Content = page;
            return(questionWindow);
        }
Exemplo n.º 2
0
        public static async Task <QuestionPage> CreateQuestionPage(Quiz previousQuiz = null)
        {
            QuestionPage questionPage = new QuestionPage()
            {
                Quiz = await Quiz.CreateQuiz(previousQuiz)
            };

            InitializeTextBlock(questionPage.QuestionTextBlock, questionPage.Quiz.CurrentQuestion.Content);
            InitializeTextBlock(questionPage.CorrectTextBlock, questionPage.Quiz.CorrectAnswersCount.ToString());
            InitializeTextBlock(questionPage.AnsweredTextBlock, $"{questionPage.Quiz.CorrectAnswersCount + questionPage.Quiz.WrongAnswersCount} / {Quiz.TotalNumberOfQuestions}");
            List <Answer> answers = questionPage.Quiz.CurrentQuestion.Answers;

            string GetAnswer(QuestionOrder order) => answers[(int)order].Content;

            questionPage.AnswerA.Content = GetAnswer(QuestionOrder.A);
            questionPage.AnswerB.Content = GetAnswer(QuestionOrder.B);
            questionPage.AnswerC.Content = GetAnswer(QuestionOrder.C);
            questionPage.AnswerD.Content = GetAnswer(QuestionOrder.D);
            return(questionPage);
        }
Exemplo n.º 3
0
 private async void PlayButton_Click(object sender, RoutedEventArgs e)
 {
     ((QuestionWindow)Window.GetWindow(this)).QuestionFrame
     .Navigate(await QuestionPage.CreateQuestionPage());
 }