private void AddQuestion_Executed(object sender) { QuestionTypeChooseDialog dlg = new QuestionTypeChooseDialog(new List<QuestionType>(){QuestionType.SingleChoice,QuestionType.MultiChoice,QuestionType.TextQuestion}); if (dlg.ShowDialog() == true) { QuestionBase question = null; if (dlg.ChoosenType == QuestionType.SingleChoice) { question = new QSingleChoice(); } if (dlg.ChoosenType == QuestionType.MultiChoice) { question = new QMultiChoice(); } if (dlg.ChoosenType == QuestionType.TextQuestion) { question = new QTextChoice(); } if (question != null) { question.Name = "Question " + (this.Questions.Count+1); question.Number = this.Questions.Count; this._manager.AddQuestion(question); OnUpdateQuestionsListHandler(this,new EventArgs()); ShowQuestion(question); } } }
public static ObservableCollection<QuestionBase> _Debug_GetTestQuestions() { ObservableCollection<QuestionBase> res; res = new ObservableCollection<QuestionBase>(); { QSingleChoice q = new QSingleChoice() { Name = "A1", Number = 1, Data = new MediaData("Lol1") { Files = new ObservableCollection<MediaFile>() { new MediaFile("TEXT1") } } }; Answer ans = new Answer(new MediaData("Answer1"), true); q.Answers.Add(ans); Answer ans2 = new Answer(new MediaData("Answer2"), false); q.Answers.Add(ans2); res.Add(q); } { QSingleChoice q2 = new QSingleChoice() { Name = "A2", Number = 2, Data = new MediaData("Lol2") { Files = new ObservableCollection<MediaFile>() { new MediaFile("TEXT2") } } }; var ans = new Answer(new MediaData("Answer1"), false); q2.Answers.Add(ans); var ans2 = new Answer(new MediaData("Answer2"), true); q2.Answers.Add(ans2); res.Add(q2); } { QMultiChoice q3 = new QMultiChoice() { Name = "A3", Number = 3, Data = new MediaData("Lol3") }; var ans = new MultiChoiceBallAswer(new MediaData("Answer1"), true); q3.Answers.Add(ans); var ans2 = new MultiChoiceBallAswer(new MediaData("Answer2"), true); q3.Answers.Add(ans2); res.Add(q3); } return res; }
public MultiChoiceQuestionViewModel(QMultiChoice questionModel) : base(questionModel) { }
private static string getMQText(QMultiChoice question) { string q_main = string.Format( "Название вопроса: {0}" + Environment.NewLine + "Тип: {1}" + Environment.NewLine + "Максимальный балл: {2}" + Environment.NewLine + "Текст вопроса: {3}" + Environment.NewLine, question.Name, "Множественный выбор", question.MaxBall, question.Data.Text ); string q_answers = ""; #region get_answers if (question.VerifyByBalls == true) { int n = 1; foreach (MultiChoiceBallAswer ans in question.Answers) { string answer; answer = string.Format("{0}) Балл[{1}] {2}", n, ans.Ball, ans.Data.Text); n++; q_answers += answer + Environment.NewLine; } } else { int n = 1; foreach (Answer ans in question.Answers) { string answer; if (ans.IsTrue == true) { answer = string.Format("{0}) [Правильный] {1}", n, ans.Data.Text); } else { answer = string.Format("{0}) {1}", n, ans.Data.Text); } q_answers += answer + Environment.NewLine; n++; } } #endregion q_main += Environment.NewLine + q_answers; return q_main; }
public MQView(QMultiChoice q) : this(new MultiChoiceQuestionViewModel(q)) { }