private void AddNewPipeComponentType(NodeView nodeView) { AddPipeComponentTypeDialog dialog = new AddPipeComponentTypeDialog(); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { PipeComponentType pipeComponentType = dialog.PipeComponentType; NodeView child = new NodeView(nodeView) { Id = pipeComponentType.Id, Name = pipeComponentType.Name, Description = pipeComponentType.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.ComponentType, HasChildren = true, SortField = pipeComponentType.Ordinal.ToString() }; if (nodeView.ChildrenLoaded) { nodeView.Children.Add(child); nodeView.Sort(); } } }; }
private void EditPipeComponentType(NodeView nodeView) { AddPipeComponentTypeDialog dialog = new AddPipeComponentTypeDialog(nodeView.Id); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { PipeComponentType pipeComponentType = dialog.PipeComponentType; nodeView.Name = pipeComponentType.Name; nodeView.Description = pipeComponentType.Description; nodeView.SortField = pipeComponentType.Ordinal.ToString(); nodeView.Sort(); } }; }