Exemple #1
0
            /// <summary>
            /// Handles Edit Question Button Click event
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            void btnEditQuestion_Click(object sender, EventArgs e)
            {
                //display form
                frmQuestion questionForm = new frmQuestion(myQuestion);
                questionForm.ShowDialog();

                //update question box
                this.lblQuestion.Text = myQuestion.Text;
                for (int i = 0; i < myQuestion.Answers.Count; i++)
                {
                    rbtnAnswers[i].Text = myQuestion.Answers[i].Text;
                    rbtnAnswers[i].Checked = myQuestion.Answers[i].Correct;
                }
            }
Exemple #2
0
        void btnAddQuestion_Click(object sender, EventArgs e)
        {
            QuestionData newQuestion = new QuestionData(0);
            frmQuestion questionForm = new frmQuestion(newQuestion);
            questionForm.ShowDialog();

            //check to see the question is valid ie user didnt cancel
            if (newQuestion.Answers.Count > 0)
            {
                //add question to display
                QuestionBox questionBox = new QuestionBox(newQuestion, questionBoxes.Count + 1, myObjective);
                questionBox.Disposed += new EventHandler(questionBox_Disposed);
                questionBoxes.Add(questionBox);
                pnlMain.Controls.Add(questionBox);

                //add question to currentQuiz we are editing
                GlobalData.currentQuiz.addQuestion(newQuestion);

                //set locations via resize
                pnlMain_Resize(null, null);

                pnlMain.ScrollControlIntoView(questionBox);
            }
        }