public AddEditMobilePlantTypeDialog(int id)
        {
            InitializeComponent();

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

            model.DataLoaded += (s1) =>
                {
                    DataContext = model;
                    Utils.ResetOriginalValues(this);
                };
        }
        private void AddType(NodeView nodeView)
        {
            AddEditMobilePlantTypeDialog dialog = new AddEditMobilePlantTypeDialog();
            AddEditMobilePlantTypeModel addEditMobilePlantTypeModel = new AddEditMobilePlantTypeModel();
            addEditMobilePlantTypeModel.View = dialog;
            dialog.DataContext = addEditMobilePlantTypeModel;
            dialog.Show();

            dialog.Closed +=
                (s1, e1) =>
                {
                    NodeView parentNode = nodeView;
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {

                        NodeView child = new NodeView(parentNode)
                            {
                                Id = dialog.MobilePlantType.Id,
                                Name = dialog.MobilePlantType.Name,
                                Description = dialog.MobilePlantType.Description,
                                Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
                                Type = NodeType.MobilePlantTypeNode,
                                SortField = dialog.MobilePlantType.Ordinal.ToString(),
                                IsActive = dialog.MobilePlantType.IsActive,
                                HasChildren = true
                            };
                        parentNode.Children.Add(child);
                        nodeView.Sort(true);
                    }
                };
        }