private void EditMobilePlantComponentType(NodeView nodeView)
        {
            CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
            EventHandler<GetMobilePlantComponentTypeCompletedEventArgs> getMobilePlantComponentCompleted = null;
            getMobilePlantComponentCompleted = (s, eventArgs) =>
            {
                MobilePlantComponentType mc = eventArgs.Result;

                AddEditMobilePlantComponentTypeDialog addEditMobilePlantComponentType = new AddEditMobilePlantComponentTypeDialog(mc);
                addEditMobilePlantComponentType.Show();

                addEditMobilePlantComponentType.Closed += (s1, e1) =>
                {

                    if (addEditMobilePlantComponentType.DialogResult.HasValue && addEditMobilePlantComponentType.DialogResult.Value)
                    {
                        EventHandler<AddMobilePlantComponentTypeCompletedEventArgs> addCompleted = null;
                        addCompleted = (s2, e2) =>
                        {
                            MobilePlantComponentType electricalEquipmentComponentType = e2.Result as MobilePlantComponentType;
                            nodeView.Name = electricalEquipmentComponentType.Name;
                            nodeView.Description = electricalEquipmentComponentType.Description;
                            nodeView.SortField = electricalEquipmentComponentType.Ordinal.ToString();

                            cmsWebServiceClient.AddMobilePlantComponentTypeCompleted -= addCompleted;
                        };

                        cmsWebServiceClient.AddMobilePlantComponentTypeCompleted += addCompleted;
                        cmsWebServiceClient.AddMobilePlantComponentTypeAsync(addEditMobilePlantComponentType.ComponentType);
                        nodeView.Parent.Sort();
                    }
                };
                cmsWebServiceClient.GetMobilePlantComponentTypeCompleted -= getMobilePlantComponentCompleted;
            };
            cmsWebServiceClient.GetMobilePlantComponentTypeCompleted += getMobilePlantComponentCompleted;
            cmsWebServiceClient.GetMobilePlantComponentTypeAsync(nodeView.Id);
        }
        private void AddMobilePlantComponentType(NodeView nodeView)
        {
            CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
            AddEditMobilePlantComponentTypeDialog dialog = new AddEditMobilePlantComponentTypeDialog();
            dialog.Show();

            dialog.Closed += (s1, e1) =>
            {
                if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                {
                    EventHandler<AddMobilePlantComponentTypeCompletedEventArgs> addCompleted = null;
                    addCompleted = (s2, eventArgs) =>
                    {
                        MobilePlantComponentType mect = eventArgs.Result;

                        if (mect != null)
                        {
                            NodeView child = new NodeView(nodeView)
                            {
                                Id = mect.Id,
                                Name = dialog.ComponentType.Name,
                                Description = dialog.ComponentType.Description,
                                Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
                                Type = NodeType.MobilePlantComponentType,
                                HasChildren = true,
                                SortField = dialog.ComponentType.Ordinal.ToString()
                            };
                            if (nodeView.ChildrenLoaded)
                            {
                                nodeView.Children.Add(child);
                                nodeView.Sort();
                            }
                        }

                        cmsWebServiceClient.AddMobilePlantComponentTypeCompleted -= addCompleted;
                    };

                    cmsWebServiceClient.AddMobilePlantComponentTypeCompleted += addCompleted;
                    cmsWebServiceClient.AddMobilePlantComponentTypeAsync(dialog.ComponentType);
                }
            };
        }