public static void AddQuestion(Question q) { if ((q.Parent == null)&&(Core.Root != null)) { throw new Exception("Виберіть предка для запитання"); } }
public Question(XmlNode e, Question parent) { Parent = parent; ID = Core.NextID; Title = e.Attributes["title"].Value; Text = e.Attributes["text"].Value; if (e.ChildNodes.Count > 0) { foreach (XmlNode item in e.ChildNodes) { Children.Add(new Question(item, this)); } } }
private void AddItem() { if (textBoxTitle.Text == "") { MessageBox.Show("Введіть дані"); return; } Question q = new Question(); q.Text = textBoxText.Text; q.Title = textBoxTitle.Text; if (Selected != null) { Selected.AddChild(q); } else { MessageBox.Show("Спочатку виберіть батьківський елемент"); } Core.OutputTree(treeView); ShowSelectedInTree(); }
public void AddChild(Question q) { q.ID = Core.NextID; this.Children.Add(q); q.Parent = this; }
public static void LoadFile(String filePath) { try { Core.id = 0; Core.doc.Load(filePath); Core.Root = new Question(Core.XmlRoot.FirstChild, null); } catch (Exception e) { MessageBox.Show(e.Message); } }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (listBox1.SelectedIndex < 0) return; Selected = Selected.Children[listBox1.SelectedIndex]; ShowQuestion(); }
private void button1_Click(object sender, EventArgs e) { Selected = Selected.Parent; ShowQuestion(); }
private void BeginTest() { Selected = Core.GetSelected(0); ShowQuestion(); }