//Toon dialoog voor vraag toevoegen na klikken op 'Vraag Toevoegen' private void btnAddQuestion_Click(object sender, EventArgs e) { Dialog = new AddQuestionDialog(this); Dialog.ShowDialog(); }
//Als op de knop 'Wijzig' is geklikt private void btnEditQuestion_Click(object sender, EventArgs e) { MultipleChoiceQuestion currentQuestion = null; int currentQuestionIndex = 0; //Controleer of er een Node geselecteerd is if (tvQuestions.SelectedNode != null) { //Bepaal vraag als attribuut voor Dialog currentQuestion = (MultipleChoiceQuestion) tvQuestions.SelectedNode.Tag; if (AddQuestionnaireController != null) { currentQuestionIndex = AddQuestionnaireController.Model.Questionnaire.Questions.FindIndex(ql => ql.QuestionIndex == currentQuestion.QuestionIndex); AddQuestionnaireController.CheckButtons(); } if (QuestionnaireDetailController != null) { currentQuestionIndex = QuestionnaireDetailController.Model.Questionnaire.Questions.FindIndex(ql => ql.QuestionIndex == currentQuestion.QuestionIndex); } //currentQuestionIndex = Questionnaire.Questions.FindIndex(ql => ql.QuestionIndex == currentQuestion.QuestionIndex); } //Toon dialoog AddQuestionDialog editDialog = new AddQuestionDialog(this, currentQuestion, (currentQuestionIndex + 1)); DialogResult dr = editDialog.ShowDialog(); //Als op OK is geklikt, verwijder de oude vraag. //Nieuwe vraag is toegevoegd bij het sluiten van het dialoog if (dr == DialogResult.OK) { if (AddQuestionnaireController != null) { AddQuestionnaireController.Model.Questionnaire.Questions.RemoveAt(currentQuestionIndex); AddQuestionnaireController.CheckButtons(); } if (QuestionnaireDetailController != null) { QuestionnaireDetailController.Model.Questionnaire.Questions.RemoveAt(currentQuestionIndex); } } //Update de TreeView UpdateTreeView(); }
public void SetQuestionDialog(AddQuestionDialog questionDialog) { this.AddQuestionDialog = questionDialog; }