public QuestionGroupVM(QuestionGroup questionGroup, ObservableCollection<QuestionVM> allQuestions) { this.questionGroup = questionGroup; this.questions = new ObservableCollection<QuestionVM>(); foreach (string questionId in questionGroup.QuestionIds) { QuestionVM question = EDOUtils.Find(allQuestions, questionId); if (question != null) //管理下にないVMを流用しているのでParentは変更しないこと。 { questions.Add(question); } } }
public bool ContainsInQuestionGroup(Question question) { return(QuestionGroup.Contains(QuestionGroups, question)); }
public QuestionGroup FindQuestionGroup(string questionGroupId) { return(QuestionGroup.Find(QuestionGroups, questionGroupId)); }
public void AddQuestionGroup() { InputDialog dlg = new InputDialog(); dlg.Title = Resources.InputQuestionGroupName; //質問グループの名前を入力してください dlg.Owner = Application.Current.MainWindow; dlg.ShowDialog(); if (dlg.DialogResult == true) { QuestionGroup questionGroupModel = new QuestionGroup() { Title = dlg.textBox.Text }; QuestionGroupVM questionGroup = new QuestionGroupVM(questionGroupModel) { Parent = this }; questionGroups.Add(questionGroup); if (SelectedQuestionGroup == null) { SelectedQuestionGroup = questionGroup; } Memorize(); } }
public static QuestionGroup CreateQuestionGroup(XElement questionGroupElem, List<Question> questionModels) { string id = (string)questionGroupElem.Attribute(ATTR_ID); if (id == null) { return null; } QuestionGroup questionGroup = new QuestionGroup(); questionGroup.Id = id; //タイトル questionGroup.Title = (string)questionGroupElem.Element(d + TAG_MULTIPLE_QUESTION_ITEM_NAME); //メモ XElement questionTextElem = questionGroupElem.Element(d + TAG_QUESTION_TEXT); if (questionTextElem != null) { XElement literalTextElem = questionTextElem.Descendants(d + TAG_TEXT).FirstOrDefault(); if (literalTextElem != null) { questionGroup.Memo = literalTextElem.Value; } } IEnumerable<XElement> elements = questionGroupElem.Descendants(d + TAG_QUESTION_ITEM); foreach (XElement questionElem in elements) { Question questionModel = CreateQuestion(questionElem); if (questionModel != null) { questionModels.Add(questionModel); } } foreach (Question questionModel in questionModels) { questionGroup.QuestionIds.Add(questionModel.Id); } return questionGroup; }
public QuestionGroupVM(QuestionGroup questionGroup) : this(questionGroup, new ObservableCollection<QuestionVM>()) { }