public AddEditMechanicalEquipmentTypeDialog(int id)
        {
            InitializeComponent();

            AddEditMechanicalEquipmentTypeModel model = new AddEditMechanicalEquipmentTypeModel(id);
            model.View = this;

            model.DataLoaded += () =>
                {
                    DataContext = model;
                    Utils.ResetOriginalValues(this);
                };
        }
        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);
                    }
                };
        }