private void toolStripButton1_Click(object sender, EventArgs e) { var addForm = new AddDepartmentAndPcForm(); var emptyNode = new TreeNode { Tag = new NodeProperty(-1, NodeTypeEnum.DeviceNode) }; addForm.CurrentNode = emptyNode; addForm.ParentNode = ((NodeProperty)treeViewComputers.SelectedNode.Tag).NodeType == NodeTypeEnum.DepartmentNode ? treeViewComputers.SelectedNode : treeViewComputers.SelectedNode.Parent; addForm.InitializeForm(); addForm.ShowDialog(); }
private void toolStripButton2_Click(object sender, EventArgs e) { if (treeViewComputers.SelectedNode.Index < 0) { return; } var addForm = new AddDepartmentAndPcForm { CurrentNode = treeViewComputers.SelectedNode, ParentNode = ((NodeProperty)treeViewComputers.SelectedNode.Tag).NodeType == NodeTypeEnum.DepartmentNode ? treeViewComputers.SelectedNode : treeViewComputers.SelectedNode.Parent }; addForm.InitializeForm(); addForm.ShowDialog(); }