Exemplo n.º 1
0
        private void Option4_Click(object sender, EventArgs e)
        {
            /* Checking answer */
            if (questType[currentQuestion] == 0 || questType[currentQuestion] == 1 || questType[currentQuestion] == 4 || questType[currentQuestion] == 5)
            {
                MultipleChoice quest = (MultipleChoice)questions[currentQuestion];
                answered = true;

                if (quest.Answer == 4)
                {
                    totalCorrect++;
                    TotalScore.Text = totalCorrect.ToString();
                    MessageBox.Show("Correct!");
                }
                else
                {
                    MessageBox.Show("AHAHAHAHAHA!!!");
                }
            }

            NextQuestion(sender, e);   // Goes to next question
        }
Exemplo n.º 2
0
        private void DisplayQuestion(int QuestNum)
        {
            Invalidate();   // Redraws

            /* Reset variables */
            answered   = false;
            imagePaint = false;


            /* Printing question */
            if (questType[QuestNum] == 0)   // If multiple choice question without image
            {
                MultipleChoice quest = (MultipleChoice)questions[QuestNum];

                /* Setting layout */
                SettingButtons(true, new Point(15, 60), new Point(225, 60), new Point(15, 110), new Point(225, 110));
                SettingCheckBoxes(false);
                SettingImage(false, false);
                checkAnswer_btn.Visible = false;

                /* Setting text */
                QuestionText.Text = quest.QuestText;
                option1_btn.Text  = quest.Choice1;
                option2_btn.Text  = quest.Choice2;
                option3_btn.Text  = quest.Choice3;
                option4_btn.Text  = quest.Choice4;
            }
            else if (questType[QuestNum] == 1)  // If multiple choice question with image
            {
                MultipleChoice quest = (MultipleChoice)questions[QuestNum];

                /* Setting layout */
                SettingButtons(true, new Point(15, 160), new Point(225, 160), new Point(15, 210), new Point(225, 210));
                SettingCheckBoxes(false);
                SettingImage(true, quest.ImgLocation, new Size(100, 100), new Point(15, 50), false);
                checkAnswer_btn.Visible = false;

                /* Setting text */
                QuestionText.Text = quest.QuestText;
                option1_btn.Text  = quest.Choice1;
                option2_btn.Text  = quest.Choice2;
                option3_btn.Text  = quest.Choice3;
                option4_btn.Text  = quest.Choice4;
            }
            else if (questType[QuestNum] == 2)  // If lists question without image
            {
                Lists quest = (Lists)questions[QuestNum];

                /* Setting layout */
                SettingButtons(false);
                SettingCheckBoxes(true, new Point(15, 60), new Point(225, 60), new Point(15, 110), new Point(225, 110));
                SettingImage(false, false);
                checkAnswer_btn.Visible = true;

                /* Setting text */
                QuestionText.Text  = quest.QuestText;
                option1_check.Text = quest.Choice1;
                option2_check.Text = quest.Choice2;
                option3_check.Text = quest.Choice3;
                option4_check.Text = quest.Choice4;
            }
            else if (questType[QuestNum] == 3)  // If lists question with image
            {
                Lists quest = (Lists)questions[QuestNum];

                /* Setting layout */
                SettingButtons(false);
                SettingCheckBoxes(true, new Point(15, 160), new Point(225, 160), new Point(15, 210), new Point(225, 210));
                SettingImage(true, quest.ImgLocation, new Size(100, 100), new Point(15, 50), false);
                checkAnswer_btn.Visible = true;

                /* Setting text */
                QuestionText.Text  = quest.QuestText;
                option1_check.Text = quest.Choice1;
                option2_check.Text = quest.Choice2;
                option3_check.Text = quest.Choice3;
                option4_check.Text = quest.Choice4;
            }
            else if (questType[QuestNum] == 4)  // If multiple choice question with zoom out image
            {
                MultipleChoice quest = (MultipleChoice)questions[QuestNum];

                /* Setting layout */
                SettingButtons(true, new Point(15, 160), new Point(225, 160), new Point(15, 210), new Point(225, 210));
                SettingCheckBoxes(false);
                SettingImage(false, true);
                checkAnswer_btn.Visible = false;

                /* Setting text */
                QuestionText.Text = quest.QuestText;
                option1_btn.Text  = quest.Choice1;
                option2_btn.Text  = quest.Choice2;
                option3_btn.Text  = quest.Choice3;
                option4_btn.Text  = quest.Choice4;

                zoomImg = quest.ImgLocation;

                /* Run threads */
                zoomRun      = true;
                countdownRun = true;
                threadDone1  = false;
                threadDone2  = false;

                imagePaint = true;

                zoom = new Thread(ZoomImage);
                time = new Thread(Countdown);

                zoom.Start();
                time.Start();
            }
            else if (questType[QuestNum] == 5)   // If timed question
            {
                MultipleChoice quest = (MultipleChoice)questions[QuestNum];

                /* Setting layout */
                SettingButtons(true, new Point(15, 60), new Point(225, 60), new Point(15, 110), new Point(225, 110));
                SettingCheckBoxes(false);
                SettingImage(false, false);
                checkAnswer_btn.Visible = false;

                /* Setting text */
                QuestionText.Text = quest.QuestText;
                option1_btn.Text  = quest.Choice1;
                option2_btn.Text  = quest.Choice2;
                option3_btn.Text  = quest.Choice3;
                option4_btn.Text  = quest.Choice4;

                /* Run threads */
                zoomRun      = true;
                countdownRun = true;

                zoom = new Thread(ZoomImage);
                time = new Thread(Countdown);

                zoom.Start();
                time.Start();
            }
        }