Esempio n. 1
0
        public void EditNode(string kl, InfElem infEl)
        {
            if (infEl.kl != kl)
            {
                throw new MyExcept("Ошибка! Разные ключи!");
            }
            ElemTree elem = FindNode(r, kl);

            if (elem == null)
            {
                throw new MyExcept("Узел с таким ключем не найден!");
            }
            elem.D.sokrName = infEl.sokrName;
            elem.D.name     = infEl.name;
        }
Esempio n. 2
0
        private void but_Add_Click(object sender, EventArgs e)
        {
            string skrName, name, kl, txt_search;

            skrName    = text_skr.Text;
            name       = text_inf.Text;
            kl         = text_key.Text;
            txt_search = text_task.Text;
            try {
                InfElem elem = new InfElem(skrName, name, kl);
                T.Add_Node(txt_search, elem);
            }catch (MyExcept ex) {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 3
0
        private void but_edit_Click(object sender, EventArgs e)
        {
            string skrName, name, kl;

            skrName = text_skr.Text;
            name    = text_inf.Text;
            kl      = text_key.Text;
            try {
                InfElem elem = new InfElem(skrName, name, kl);
                T.EditNode(text_key.Text, elem);
            } catch (MyExcept ex) {
                MessageBox.Show(ex.Message);
            } catch (Exception ex1) {
                MessageBox.Show(ex1.Message);
            }
        }
Esempio n. 4
0
        private void butCreate_Click(object sender, EventArgs e)
        {
            string skrName, name, kl;

            skrName = text_skr.Text;
            name    = text_inf.Text;
            kl      = text_key.Text;
            if (kl == "" || name == "" || skrName == "")
            {
                MessageBox.Show("Вы не заполнили все поля!");
                return;
            }
            InfElem elem = new InfElem(skrName, name, kl);

            T = new Tree(elem);
            textBox_test.Clear();
        }
Esempio n. 5
0
        public void Add_Node(string Tkey, InfElem Tinf)
        {
            ElemTree elem = FindNode(r, Tkey);

            if (elem == null)
            {
                throw new MyExcept("Узел с таким ключем не найден!");
            }

            if (elem.FL == null)
            {
                elem.FL = new ElemTree(Tinf);
            }
            else
            {
                ElemTree temp = elem.FL;
                while (temp.FR != null)
                {
                    temp = temp.FR;
                }
                temp.FR = new ElemTree(Tinf);
            }
        }
Esempio n. 6
0
 public Tree(InfElem inf)
 {
     r = new ElemTree(inf);
 }
Esempio n. 7
0
 public ElemTree(InfElem d)
 {
     this.D  = d;
     this.FL = null;
     this.FR = null;
 }