private void EditType(NodeView nodeView) { var dialog = new AddEditControlSystemTypeDialog(nodeView.Id); dialog.Title = "Edit ControlSystem Equipment Type"; dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { nodeView.Name = string.Format("{0} ({1})", dialog.ControlSystemType.Name, dialog.ControlSystemType.Description); nodeView.Description = dialog.ControlSystemType.Description; nodeView.SortField = dialog.ControlSystemType.Name; nodeView.Parent.Sort(); } }; }
private void AddType(NodeView nodeView) { var dialog = new AddEditControlSystemTypeDialog(); dialog.Show(); dialog.Closed += (s1, e1) => { var parentNode = nodeView; if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { var child = new NodeView(parentNode) { Id = dialog.ControlSystemType.Id, Name = string.Format("{0} ({1})", dialog.ControlSystemType.Name, dialog.ControlSystemType.Description), Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.ControlSystemTypeNode, Description = dialog.ControlSystemType.Description, HasChildren = false, SortField = dialog.ControlSystemType.Name }; if (nodeView.ChildrenLoaded) { parentNode.Children.Add(child); nodeView.Sort(); } } }; }