Пример #1
0
 private void PreparePracticeForms()
 {
     if (question.SubtypeId == (int)Question.Subtype.ReadingComprehensionQuestionToPassage)
     {
         practiceForm.panel.Controls.Remove(generalQuestionPanel);
         practiceForm.panel.Controls.Add(readingComprehensionPanel);
         passagePictureBox        = readingComprehensionPanel.passagePictureBox;
         questionPictureBox       = readingComprehensionPanel.questionPictureBox;
         questionPanel            = readingComprehensionPanel.questionPanel;
         clockTimer               = practiceForm.clockTimer;
         statusBar                = practiceForm.statusBar;
         imageSet                 = renderer.Render(question);
         questionPictureBox.Image = imageSet.Question;
         passagePictureBox.Image  =
             renderer.RenderPasssageToQuestion(navigator.GetPasssageToQuestion(question.Id));
     }
     else
     {
         practiceForm.panel.Controls.Remove(readingComprehensionPanel);
         practiceForm.panel.Controls.Add(generalQuestionPanel);
         questionPictureBox       = generalQuestionPanel.questionPictureBox;
         questionPanel            = generalQuestionPanel.questionPanel;
         clockTimer               = practiceForm.clockTimer;
         statusBar                = practiceForm.statusBar;
         imageSet                 = renderer.Render(question);
         questionPictureBox.Image = imageSet.Question;
     }
 }
Пример #2
0
        private void TestFormInit(TestWebForm testWebForm)
        {
            GetNextQuestion();

            loginStatusHyperLink.Text        = "Log out...";
            loginStatusHyperLink.NavigateUrl = "loginWebForm.aspx";
            questionGUID = Guid.NewGuid();
            testWebForm.PassageImage.Visible = false;
            if (question.SubtypeId == (int)BuisinessObjects.Subtype.ReadingComprehensionPassage)
            {
            }
            if (question.SubtypeId == (int)BuisinessObjects.Subtype.ReadingComprehensionQuestionToPassage)
            {
                passageGUID = Guid.NewGuid();
                imageSet    = renderer.Render(question);
                testWebForm.PassageImage.Visible = true;
                imageSet.Question.Save(
                    mapPath + @"\images\Question&AnswerTempPictures\" + questionGUID + ".gif",
                    ImageFormat.Gif);
                testWebForm.QuestionImage.ImageUrl = @"images/Question&AnswerTempPictures/" + questionGUID +
                                                     ".gif";
                (renderer.RenderPasssageToQuestion(navigator.GetPasssageToQuestion(question.Id))).Save(
                    mapPath + @"\images\Question&AnswerTempPictures\" + passageGUID + ".gif", ImageFormat.Gif);
                testWebForm.PassageImage.ImageUrl = @"images/Question&AnswerTempPictures/" + passageGUID +
                                                    ".gif";
                PrepareAndRenderAnswers();
            }
            else
            {
                imageSet = renderer.Render(question);
                imageSet.Question.Save(
                    mapPath + @"\images\Question&AnswerTempPictures\" + questionGUID + ".gif",
                    ImageFormat.Gif);
                testWebForm.QuestionImage.ImageUrl = @"images/Question&AnswerTempPictures/" + questionGUID +
                                                     ".gif";
                PrepareAndRenderAnswers();
            }


            testWebForm.clockHiddenParam += "<INPUT id=\"timehh\" type=\"hidden\" value=\"" +
                                            navigator.RemainedTime.Hours + "\" name=\"timehh\">";
            testWebForm.clockHiddenParam += "<INPUT id=\"timemm\" type=\"hidden\" value=\"" +
                                            navigator.RemainedTime.Minutes + "\" name=\"timemm\">";
            testWebForm.clockHiddenParam += "<INPUT id=\"timess\" type=\"hidden\" value=\"" +
                                            navigator.RemainedTime.Seconds + "\" name=\"timess\">";

            testWebForm.TestNameLabel.Text = "Test: " + testRow.Name;

            //<INPUT id="isAnswerConfirm" type="hidden" value="false" name="isAnswerConfirm"><INPUT id="Hidden1" type="hidden" name="endData">
        }
Пример #3
0
        private void CheckNavigator(INavigator navigator)
        {
            QuestionSetSet.QuestionSetsRow qs;
            QuestionAnswerSet qd = new QuestionAnswerSet();

            while (navigator.HasNextSet)
            {
                if (navigator.HasPreviousSet && random.Next(3) == 1)
                {
                    qs = navigator.GetPreviousSet();
                }
                else
                {
                    qs = navigator.GetNextSet();
                }

                while (navigator.HasNextQuestion)
                {
                    if (navigator.HasPreviousQuestion && random.Next(3) == 1)
                    {
                        navigator.GetPreviousQuestion(qd);
                    }
                    else
                    {
                        navigator.GetNextQuestion(qd);
                    }

                    QuestionAnswerSet.QuestionsRow q = qd.Questions[0];

                    if (q.SubtypeId == (byte)Question.Subtype.ReadingComprehensionPassage)
                    {
                        Assert.Fail("Set cannot directly contain question of type ReadingComprehensionPassage");
                    }

                    if (q.SubtypeId == (byte)Question.Subtype.ReadingComprehensionQuestionToPassage)
                    {
                        navigator.GetPasssageToQuestion(q.Id);
                    }

                    QuestionAnswerSet.AnswersRow[] a = q.GetAnswersRows();

                    navigator.SetUserAnswer(a[random.Next(a.Length)].Id);
                }
            }

            navigator.CommitResult();
        }