Esempio n. 1
0
        private void AddClosedQuestion()
        {
            ClosedQuestion     closedQuestion = (ClosedQuestion)_section.Questions.Add(QuestionTypes.Closed);
            ChoiceQuestionForm closedQnFrm    = new ChoiceQuestionForm();

            closedQnFrm.PickValues(closedQuestion);
            closedQnFrm.ShowDialog();
            RefreshQuestions();
        }
Esempio n. 2
0
        private void EditQuestion(MouseEventArgs e)
        {
            TreeNode treeNode = Tree.GetNodeAt(e.X, e.Y);

            if (!(treeNode.Tag is Question))
            {
                return;
            }
            Question question = treeNode.Tag as Question;

            switch (question.QuestionType)
            {
            case QuestionTypes.Closed:
                ChoiceQuestionForm form = new ChoiceQuestionForm();
                form.PickValues(question as ClosedQuestion);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    treeNode.Text = question.Name;
                }
                break;

            case QuestionTypes.MultipleChoice:
                ChoiceQuestionForm formM = new ChoiceQuestionForm();
                formM.PickValues(question as MultipleChoiceQuestion);
                if (formM.ShowDialog() == DialogResult.OK)
                {
                    treeNode.Text = question.Name;
                }
                break;

            case QuestionTypes.Open:
                OpenQuestionForm formOpen = new OpenQuestionForm();
                formOpen.PickValues(question as OpenQuestion);
                if (formOpen.ShowDialog() == DialogResult.OK)
                {
                    treeNode.Text = question.Name;
                }
                break;
            }
        }
Esempio n. 3
0
        private void AddMultipleChoiceQuestion()
        {
            if (!(Tree.SelectedNode.Tag is Questions))
            {
                return;
            }
            Questions questions = Tree.SelectedNode.Tag as Questions;
            MultipleChoiceQuestion closedQuestion = (MultipleChoiceQuestion)questions.Add(QuestionTypes.MultipleChoice);
            ChoiceQuestionForm     closedQnFrm    = new ChoiceQuestionForm();

            closedQnFrm.PickValues(closedQuestion);
            if (closedQnFrm.ShowDialog() == DialogResult.OK)
            {
                TreeNode questionsNode = Tree.SelectedNode;
                if (questionsNode != null)
                {
                    var questionNode = AddToParentNode(questionsNode, closedQuestion, closedQuestion.Name);
                    questionNode.ImageIndex         = 10;
                    questionNode.SelectedImageIndex = 10;
                }
            }
        }