private void NewQuestionnaireToolStripMenuItem_Click(object sender, EventArgs e) { Questionnaire qn = currentQNReader.Entity.MakeCopy(); availableQNs.Add(qn); currentQNReader = new QuestionnaireReader(qn); if (currentQNReader.ReadNext()) { PopulateQuestionUI(currentQNReader.Question); } }
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Node.Name.StartsWith("root")) return; Questionnaire qn = null; if (e.Node.Name.StartsWith("qn_")) { qn = availableQNs[e.Node.Index]; } else if (e.Node.Name.StartsWith("menu_node_")) { qn = availableQNs[e.Node.Parent.Index]; // There is a bug, cannot direct select from AvailableQN since the questionnaire index is not correct. } if (qn.IsQuestionnaireFinished()) { ClearQuestionUI(); } else { currentQNReader = new QuestionnaireReader(qn); if (currentQNReader.ReadNext()) { PopulateQuestionUI(currentQNReader.Question); } } }
private void MainForm_Load(object sender, EventArgs e) { string[] filenames = Directory.GetFiles(@"..\..\Resources", "*.xml"); int index = 0; foreach (string filename in filenames) { Questionnaire qn = Questionnaire.MakeNew(filename); if (index == 0) currentQNReader = new QuestionnaireReader(qn); availableQNs.Add(qn); index++; } InitializeTreeView(availableQNs); }