private void btnChangeNode_Click(object sender, EventArgs e) { CreateCategoryForm frm = new CreateCategoryForm(tvCategoryTree.SelectedNode.Text); if (frm.ShowDialog() == DialogResult.OK) { categoryManagement.ChangeTreeNode(tvCategoryTree.SelectedNode, (string)frm.Tag); InitializeUI(); } }
private void btnAddSubCategory_Click(object sender, EventArgs e) { CreateCategoryForm frm = new CreateCategoryForm(); if (frm.ShowDialog() == DialogResult.OK) { TreeNode newNode = categoryManagement.CreateTreeNode((string)frm.Tag, tvCategoryTree.SelectedNode.Name + "\\" + (string)frm.Tag, ((Category)tvCategoryTree.SelectedNode.Tag).Id); tvCategoryTree.SelectedNode.Nodes.Add(newNode); tvCategoryTree.SelectedNode.Expand(); tvCategoryTree.SelectedNode = newNode; } }