private void EditType(NodeView nodeView) { AddEditMechanicalEquipmentTypeDialog dialog = new AddEditMechanicalEquipmentTypeDialog(nodeView.Id); dialog.Title = "Edit Mechanical Equipment Type"; dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { nodeView.Name = dialog.MechanicalEquipmentType.Name; nodeView.Description = dialog.MechanicalEquipmentType.Description; nodeView.SortField = dialog.MechanicalEquipmentType.Ordinal.ToString(); nodeView.IsActive = dialog.MechanicalEquipmentType.IsActive; nodeView.Parent.Sort(true); } }; }
private void AddType(NodeView nodeView) { AddEditMechanicalEquipmentTypeDialog dialog = new AddEditMechanicalEquipmentTypeDialog(); AddEditMechanicalEquipmentTypeModel model = new AddEditMechanicalEquipmentTypeModel(); model.View = dialog; dialog.DataContext = model; dialog.Show(); dialog.Closed += (s1, e1) => { NodeView parentNode = nodeView; if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { NodeView child = new NodeView(parentNode) { Id = dialog.MechanicalEquipmentType.Id, Name = dialog.MechanicalEquipmentType.Name, Description = dialog.MechanicalEquipmentType.Description, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.MobilePlantTypeNode, HasChildren = true, SortField = dialog.MechanicalEquipmentType.Ordinal.ToString(), IsActive = dialog.MechanicalEquipmentType.IsActive }; parentNode.Children.Add(child); nodeView.Sort(true); } }; }