Пример #1
0
        private void AddSubSection()
        {
            SubSection     subSection     = _section.SubSections.Add();
            SubSectionForm subSectionForm = new SubSectionForm();

            subSectionForm.PickValues(subSection);
            if (subSectionForm.ShowDialog() == DialogResult.OK)
            {
                RefreshSubSections();
            }
        }
Пример #2
0
        private void AddSubSection()
        {
            if (Tree.SelectedNode == null)
            {
                return;
            }
            if (Tree.SelectedNode.Text != "Sub Sections")
            {
                return;
            }
            Section        section        = Tree.SelectedNode.Parent.Tag as Section;
            SubSection     subSection     = section.SubSections.Add();
            SubSectionForm subSectionForm = new SubSectionForm();

            subSectionForm.PickValues(subSection);
            subSectionForm.ShowDialog();
            var subSectionTreeNode = AddToParentNode(Tree.SelectedNode, subSection, subSection.Name);

            subSectionTreeNode.Tag = subSection;

            foreach (var qn in subSection.Questions)
            {
                TreeNode questionsNode = subSectionTreeNode.Nodes.Add("Questions");
                questionsNode.Tag = subSection.Questions;
                TreeNode questionNode = questionsNode.Nodes.Add(qn.Name);
                questionNode.Tag = qn;
                switch (qn.QuestionType)
                {
                case QuestionTypes.Closed:
                    questionNode.ImageIndex         = 6;
                    questionNode.SelectedImageIndex = 6;
                    break;

                case QuestionTypes.Open:
                    questionNode.ImageIndex         = 3;
                    questionNode.SelectedImageIndex = 3;
                    break;

                case QuestionTypes.MultipleChoice:
                    questionNode.ImageIndex         = 10;
                    questionNode.SelectedImageIndex = 10;
                    break;
                }
            }

            subSectionTreeNode.ImageIndex         = 8;
            subSectionTreeNode.SelectedImageIndex = 8;
        }