Example #1
0
File: Core.cs Project: ZAYEC77/SD1
 public static void AddQuestion(Question q)
 {
     if ((q.Parent == null)&&(Core.Root != null))
     {
         throw new Exception("Виберіть предка для запитання");
     }
 }
Example #2
0
 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));
         }
     }
 }
Example #3
0
 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();
 }
Example #4
0
 public void AddChild(Question q)
 {
     q.ID = Core.NextID;
     this.Children.Add(q);
     q.Parent = this;
 }
Example #5
0
File: Core.cs Project: ZAYEC77/SD1
 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);
     }
 }
Example #6
0
 private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listBox1.SelectedIndex < 0) return;
     Selected = Selected.Children[listBox1.SelectedIndex];
     ShowQuestion();
 }
Example #7
0
 private void button1_Click(object sender, EventArgs e)
 {
     Selected = Selected.Parent;
     ShowQuestion();
 }
Example #8
0
 private void BeginTest()
 {
     Selected = Core.GetSelected(0);
     ShowQuestion();
 }