public void Execute() { using (var categoryForm = new CategoryProperty()) { categoryForm.Category = new PageCategory(); var treeNode = ConfigToolContext.Instance.ToolWindows.GetPagesWindow().Selected as TreeNode; if (treeNode != null) { categoryForm.Category = treeNode.Tag as PageCategory; categoryForm.IsCreate = false; var result = categoryForm.ShowDialog(); if (result == DialogResult.OK) { treeNode.Text = categoryForm.Category.Name; MessageBox.Show(MultilingualUtility.GetString("SaveSuccess"), MultilingualUtility.GetString("SaveSuccess"), MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
public void Execute() { using (var categoryForm = new CategoryProperty()) { categoryForm.Category = new PageCategory(); categoryForm.Category.AdminIdx = ConfigToolContext.Instance.CurrentUser.GetAdminIdx(); var treeNode = ConfigToolContext.Instance.ToolWindows.GetPagesWindow().Selected as TreeNode; if (treeNode != null && treeNode.Tag is PageCategory) { categoryForm.Category.ParentId = (treeNode.Tag as PageCategory).Id; } else { categoryForm.Category.ParentId = PageSchemeTree.TOPPAGEPARENTID; } categoryForm.IsCreate = true; var result = categoryForm.ShowDialog(); if (result == DialogResult.OK) { ConfigToolContext.Instance.ToolWindows.GetPagesWindow().AddTreeNode(categoryForm.Category); } } }