Esempio n. 1
0
        public MRQuestionUserControl(MRQuestion mrQuestion)
        {
            InitializeComponent();

            this.mrQuestion = mrQuestion;
            this.optionListView.ItemsSource = this.tempOptionList;

            foreach (QuestionOption option in this.mrQuestion.QuestionOptionCollection)
            {
                this.tempOptionList.Add(option.Clone() as QuestionOption);
            }

            if (this.mrQuestion.Content != null)
            {
                this.richTextEditor.Text = this.mrQuestion.Content.Content;
            }
        }
Esempio n. 2
0
        internal Question CreateQuestion(QuestionType type)
        {
            Question question = null;

            switch (type)
            {
            case QuestionType.MultiChoice:
            {
                MCQuestion mcQuestion = new MCQuestion();
                for (int i = 0; i < 4; i++)
                {
                    QuestionOption option = new QuestionOption();
                    option.Index = i;
                    mcQuestion.QuestionOptionCollection.Add(option);
                }
                question = mcQuestion;
            }
            break;

            case QuestionType.MultiResponse:
            {
                MRQuestion mrQuestion = new MRQuestion();
                for (int i = 0; i < 4; i++)
                {
                    QuestionOption option = new QuestionOption();
                    option.Index = i;
                    mrQuestion.QuestionOptionCollection.Add(option);
                }
                question = mrQuestion;
            }
            break;

            case QuestionType.Essay:
            {
                ESQuestion esQuestion = new ESQuestion();
                question = esQuestion;
            }
            break;

            case QuestionType.TrueFalse:
            {
                TFQuestion     tfQuestion = new TFQuestion();
                QuestionOption optionT    = new QuestionOption();
                optionT.Index = 0;
                QuestionOption optionF = new QuestionOption();
                optionF.Index = 1;
                tfQuestion.QuestionOptionCollection.Add(optionT);
                tfQuestion.QuestionOptionCollection.Add(optionF);
                tfQuestion.RandomOption = true;

                question = tfQuestion;
            }
            break;

            case QuestionType.Match:
            {
                MAQuestion maQuestion = new MAQuestion();
                for (int i = 0; i < 4; i++)
                {
                    MAQuestionOption option = new MAQuestionOption();
                    option.Index = i;
                    maQuestion.OptionList.Add(option);
                }
                question = maQuestion;
            }
            break;

            case QuestionType.FillInBlank:
            {
                FIBQuestion fibQuestion = new FIBQuestion();
                question = fibQuestion;
            }
            break;

            case QuestionType.Composite:
            {
                CPQuestion cpQuestion = new CPQuestion();
                question = cpQuestion;
            }
            break;
            }

            question.DifficultyLevel = 3;
            question.CreateTime      = DateTime.Now.ToUniversalTime();
            question.ModifyTime      = DateTime.Now.ToUniversalTime();

            return(question);
        }