コード例 #1
0
        public ViewQuizViewModel(IEventAggregator eventAggregator, string username, int quizID)
        {
            this.eventAggregator = eventAggregator;
            this.Model           = new ViewQuizModel();

            bool success;

            //gets the quiz attempt information from the server
            (Model.QuizID, Model.Username, Model.QuizType, Model.Questions, Model.Answers, Model.CorrectQuestions, success) = QuizHandling.GetQuizInformation(username, quizID);

            if (success == false)
            {
                MessageBox.Show("Something went wrong loading the quiz. Returning to the main menu");

                ChangePageEvent changePage = new ChangePageEvent();
                changePage.pageName = "TeacherMainMenu";
                this.eventAggregator.Publish(changePage);
            }
            else
            {
                this.Model.CurrentQuestionNumber = 0;
                SetUpQuestion();
            }
        }