Exemple #1
0
        private void SetQuestionPreview(string questionOrSectionName)
        {
            ResetQuestionPreview();
            currentQuestionPreview = testForEdit.Questions.Find((item) => item.Name == questionOrSectionName);
            if (currentQuestionPreview != null)
            {
                buttonDeleteVopr.Enabled = true;
                buttonChangeVopr.Enabled = true;

                previewInfoControl          = InfoViewFactory.GetInfoViewControl(currentQuestionPreview.QuestionInfo) as UserControl;
                previewInfoControl.Location = new Point(3, 25);
                groupBoxInfo.Controls.Add(previewInfoControl);

                previewAnswerControl = PassingControlFactory.GetPassingControl(currentQuestionPreview.QuestionAnswer, true) as UserControl;
                (previewAnswerControl as IVariantPassingControl).SetDefaultDockStyle();
                previewAnswerControl.Location = new Point(3, 25);
                groupBoxAnswers.Controls.Add(previewAnswerControl);
                groupBoxAnswers.Text = "Ответы (" + currentQuestionPreview.QuestionAnswer.QuestionScore + " баллов за правильный ответ)";
            }
            else
            {
                if (questionOrSectionName != "Без раздела")
                {
                    buttonDeleteSection.Enabled = true;
                    buttonChangeSection.Enabled = true;
                }
                currentSection = questionOrSectionName;
            }
        }
Exemple #2
0
        private void NextQuestion()
        {
            //Удаление элементов для предидущего вопроса
            foreach (Control control in groupBoxInfo.Controls)
            {
                control.Dispose();
            }
            groupBoxInfo.Controls.Clear();

            foreach (Control control in groupBoxAnswer.Controls)
            {
                control.Dispose();
            }
            groupBoxAnswer.Controls.Clear();

            //Индекс следующего вопроса
            current_question++;
            if (current_question == questions.Count)
            {
                StopTest();
                return;
            }

            infoControl          = InfoViewFactory.GetInfoViewControl(questions[current_question].QuestionInfo) as UserControl;
            infoControl.Location = new Point(3, 25);
            groupBoxInfo.Controls.Add(infoControl);

            answerControl = PassingControlFactory.GetPassingControl(questions[current_question].QuestionAnswer, false) as UserControl;
            (answerControl as IVariantPassingControl).SetDefaultDockStyle();
            answerControl.Location = new Point(3, 25);
            groupBoxAnswer.Controls.Add(answerControl);
        }