public SQView(QSingleChoice q) : this(new SingleChoiceQuestionViewModel(q)) { }
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); } } }
private static string getSQText(QSingleChoice 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 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 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 SingleChoiceQuestionViewModel(QSingleChoice questionModel) : base(questionModel) { }