private void AddNewCategory(NodeView nodeView) { AddEditIssueCategoryDialog dialog = new AddEditIssueCategoryDialog(); dialog.DataContext = new AddEditCategoryModel { View = dialog }; dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { NodeView child = new NodeView(nodeView) { Id = dialog.IssueCategory.Id, Name = dialog.IssueCategory.Name, Description = dialog.IssueCategory.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.IssueCategoryNode, HasChildren = true, SortField = dialog.IssueCategory.Ordinal.ToString() }; if (nodeView.ChildrenLoaded) { nodeView.Children.Add(child); nodeView.Sort(); } } }; }
private void EditCategory(NodeView nodeView) { AddEditIssueCategoryDialog dialog = new AddEditIssueCategoryDialog(); dialog.Title = "Edit Issue Category"; AddEditCategoryModel addEditCategoryModel = new AddEditCategoryModel(nodeView.Id) { View = dialog }; addEditCategoryModel.Loaded += (obj) => { dialog.DataContext = addEditCategoryModel; Utils.ResetOriginalValues(dialog); }; dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { nodeView.Name = dialog.IssueCategory.Name; nodeView.Description = dialog.IssueCategory.Description; nodeView.SortField = dialog.IssueCategory.Ordinal.ToString(); nodeView.Parent.Sort(); //Load New Entities LoadIssueCategoryUsers(nodeView); } }; }