Ejemplo n.º 1
0
        protected virtual SoonLearning.Math.Data.Section CreateSection(SectionBaseInfo info, BackgroundWorker worker)
        {
            SoonLearning.Math.Data.Section section = ObjectCreator.CreateSection(info.Name, info.Description);

            Random rand           = new Random((int)DateTime.Now.Ticks);
            int    generatedCount = 0;

            while (true)
            {
                if (generatedCount == info.QuestionCount)
                {
                    break;
                }

                try
                {
                    AppendQuestion(info, section);
                }
                catch (Exception ex)
                {
                    Debug.Assert(false, ex.Message);
                }

                worker.ReportProgress(0, null);
                Debug.WriteLine(generatedCount);

                generatedCount++;

                Thread.Sleep(50);
            }

            return(section);
        }
        private static void CreateSection(SoonLearning.Math.Data.Section section,
                                          int index,
                                          FlowDocument flowDocument,
                                          bool showAnswer,
                                          bool showResponse,
                                          Exercise exercise)
        {
            Paragraph sectionPara = new Paragraph();

            flowDocument.Blocks.Add(sectionPara);

            // Section Title
            Run runTItle = new Run(section.Title + section.Description);

            sectionPara.Inlines.Add(runTItle);

            // Create Questions
            for (int i = 0; i < section.QuestionCollection.Count; i++)
            {
                CreateQuestion(section.QuestionCollection[i],
                               i,
                               flowDocument,
                               showAnswer,
                               showResponse,
                               exercise.GetQuestionResponse(section.QuestionCollection[i].Id));
            }
        }
Ejemplo n.º 3
0
        protected override void AppendQuestion(SectionBaseInfo info, SoonLearning.Math.Data.Section section)
        {
            int index = this.sectionInfoCollection.IndexOf(info);

            switch (info.QuestionType)
            {
            case QuestionType.MultiChoice:
                this.CreateMCQuestion(info, section);
                break;

            case QuestionType.FillInBlank:
                if (index == 0)
                {
                    this.CreateFIBQuestion(info, section);
                }
                else
                {
                    this.CreateFIBQuestionOnlyAnswer(info, section);
                }
                break;

            case QuestionType.Table:
                this.CreateTableQuestion(info, section);
                break;
            }
        }
        protected override void AppendQuestion(SectionBaseInfo info, SoonLearning.Math.Data.Section section)
        {
            switch (info.QuestionType)
            {
            case QuestionType.MultiChoice:
                this.CreateMCQuestion(info, section);
                break;

            case QuestionType.FillInBlank:
                this.CreateFIBQuestion(info, section);
                break;

            case QuestionType.Table:
                this.CreateTableQuestion(info, section);
                break;
            }
        }
Ejemplo n.º 5
0
 protected abstract void AppendQuestion(SectionBaseInfo info, SoonLearning.Math.Data.Section section);