Ejemplo n.º 1
0
 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);
         }
     }
 }
Ejemplo n.º 2
0
 public bool ContainsInQuestionGroup(Question question)
 {
     return(QuestionGroup.Contains(QuestionGroups, question));
 }
Ejemplo n.º 3
0
 public QuestionGroup FindQuestionGroup(string questionGroupId)
 {
     return(QuestionGroup.Find(QuestionGroups, questionGroupId));
 }
Ejemplo n.º 4
0
 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();
     }
 }
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 6
0
 public QuestionGroupVM(QuestionGroup questionGroup)
     : this(questionGroup, new ObservableCollection<QuestionVM>())
 {
 }