private void AddAlarmPurpose(NodeView nodeView) { var dialog = new AddEditAlarmPurposeDialog(); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { var child = new NodeView(nodeView) { Id = dialog.ControlSystemAlarmPurpose.Id, Name = dialog.ControlSystemAlarmPurpose.Name, Description = dialog.ControlSystemAlarmPurpose.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.AlarmPurposeNode, HasChildren = false, SortField = dialog.ControlSystemAlarmPurpose.Name }; if (nodeView.ChildrenLoaded) { nodeView.Children.Add(child); nodeView.Sort(); } } }; }
private void EditAlarmPurpose(NodeView nodeView) { var dialog = new AddEditAlarmPurposeDialog(nodeView.Id); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { nodeView.Name = dialog.ControlSystemAlarmPurpose.Name; nodeView.Description = dialog.ControlSystemAlarmPurpose.Description; nodeView.SortField = dialog.ControlSystemAlarmPurpose.Ordinal.ToString(); nodeView.Parent.Sort(); } }; }