private void InitializeProgram() { Book root = new Book(); root.NodeID = Guid.NewGuid().ToString(); root.NodeName = "Root"; _programManageBooks = new Tree<Book>(); _programManageBooks.AddNode("", root); BindingTree(_programManageBooks); }
private void InitializeDatabase() { Book root = new Book(); root.NodeID = Guid.NewGuid().ToString(); root.NodeName = "Root"; root.BookType = "Root"; _databaseBooks = new BooksDAL(); _databaseBooks.AddSubNode("", root); BindingDBTree(); }
private void InitializeSelf() { System.Windows.Forms.TreeNode node = new System.Windows.Forms.TreeNode("Root"); Book b = new Book(); b.NodeName = "Root"; b.Left = 1; b.Right = 2; b.Layer = 1; node.Tag = b; tvSelf.Nodes.Add(node); _selftManageBooks = new List<Book>(); _selftManageBooks.Add(b); AnalyzeTree(); }
private void button1_Click(object sender, EventArgs e) { if (null == tvSelf.SelectedNode) return; Book selectedItem = (tvSelf.SelectedNode.Tag as Book).Clone() as Book; Book child = new Book(); child.NodeID = Guid.NewGuid().ToString(); textBox1.Text = "C" + (nodeCount++).ToString(); child.NodeName = textBox1.Text; child.BookType = "TEST"; if (_isConnected) { _programManageBooks.AddNode(selectedItem, child); BindingTree(_programManageBooks); } else { _programManageBooksCopy.AddNode(selectedItem, child); } _databaseBooks.AddSubNode(selectedItem, child); BindingDBTree(); System.Windows.Forms.TreeNode newNode = new System.Windows.Forms.TreeNode(textBox1.Text); newNode.Tag = child; tvSelf.SelectedNode.Nodes.Add(newNode); AnalyzeTree(); }