private void AddElectricalComponentProperty(NodeView nodeView)
        {
            AddEditEquipmentPropertyDialog dialog = new AddEditEquipmentPropertyDialog(CommonUtils.EquipmentPropertyType.ElectricalProperty);
            dialog.Show();

            dialog.Closed +=
                (s1, e1) =>
                {
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value && dialog.ComponentProperty!=null)
                    {
                        NodeView child = new NodeView(nodeView)
                        {
                            Id = dialog.ComponentProperty.Id,
                            Name = dialog.ComponentProperty.Name,
                            Description = dialog.ComponentProperty.Description,
                            Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
                            Type = NodeType.ElectricalProperty,
                            HasChildren = false,
                            SortField = dialog.ComponentProperty.Name
                        };
                        if (nodeView.ChildrenLoaded)
                        {
                            nodeView.Children.Add(child);
                            nodeView.Sort();
                        }
                    }
                };
        }
        private void AddInterlockProperty(NodeView nodeView)
        {
            var dialog = new AddEditEquipmentPropertyDialog(CommonUtils.EquipmentPropertyType.ControlInterlockProperty);
            dialog.Show();

            dialog.Closed +=
                (s1, e1) =>
                {
                    var parentNode = nodeView;
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        var child = new NodeView(parentNode)
                        {
                            Id = dialog.ComponentProperty.Id,
                            Name = dialog.ComponentProperty.Name,
                            Description = dialog.ComponentProperty.Description,
                            Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
                            Type = NodeType.InterlockProperty,
                            HasChildren = false,
                            SortField = dialog.ComponentProperty.Name
                        };
                        if (nodeView.ChildrenLoaded)
                        {
                            parentNode.Children.Add(child);
                            nodeView.Sort();
                        }
                    }
                };
        }
 private void EditSystemTest(NodeView nodeView)
 {
     var dialog = new AddEditEquipmentPropertyDialog(CommonUtils.EquipmentPropertyType.SystemTestingProperty, nodeView.Id, "100");
     dialog.Show();
     dialog.Closed +=
         (s1, e1) =>
         {
             if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
             {
                 nodeView.Name = dialog.ComponentProperty.Name;
                 nodeView.Description = dialog.ComponentProperty.Description;
                 nodeView.SortField = dialog.ComponentProperty.Name;
                 nodeView.Parent.Sort();
             }
         };
 }
        private void EditProperty(NodeView nodeView)
        {
            AddEditEquipmentPropertyDialog dialog = new AddEditEquipmentPropertyDialog(CommonUtils.EquipmentPropertyType.MobilePlantProperty,nodeView.Id);
            dialog.Title = "Edit Mobile Property";
            dialog.Show();

            dialog.Closed +=
                (s1, e1) =>
                    {
                        if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                        {
                            nodeView.Name = dialog.ComponentProperty.Name;
                            nodeView.Description = dialog.ComponentProperty.Description;
                            nodeView.SortField = dialog.ComponentProperty.Name.ToString();
                            nodeView.Parent.Sort();
                        }
                    };
        }
        private void AddProperty(NodeView nodeView)
        {
            AddEditEquipmentPropertyDialog dialog = new AddEditEquipmentPropertyDialog(CommonUtils.EquipmentPropertyType.MobilePlantProperty);
            dialog.Show();

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

                        NodeView child = new NodeView(parentNode)
                        {
                            Id = dialog.ComponentProperty.Id,
                            Name = dialog.ComponentProperty.Name,
                            Description = dialog.ComponentProperty.Description,
                            Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
                            Type = NodeType.MobilePropertyNode,
                            SortField = dialog.ComponentProperty.Name.ToString(),
                            HasChildren = false
                        };
                        parentNode.Children.Add(child);
                        nodeView.Sort();
                    }
                };
        }
Esempio n. 6
0
        private void AddNewPipeProperty(NodeView nodeView)
        {
            AddEditEquipmentPropertyDialog dialog = new AddEditEquipmentPropertyDialog(CommonUtils.EquipmentPropertyType.PipeProperty);
            dialog.Show();

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

                if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                {
                    EventHandler<AddPipePropertyCompletedEventArgs> addCompleted = null;
                    addCompleted = (s2, eventArgs) =>
                    {
                        PipeProperty pipeComponentProperty = eventArgs.Result as PipeProperty;
                        NodeView child = new NodeView(nodeView)
                                             {
                                                 Id = pipeComponentProperty.Id,
                                                 Name = pipeComponentProperty.Name,
                                                 Description = pipeComponentProperty.Description,
                                                 Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
                                                 Type = NodeType.PipePropertyUndeStandardComponentProperties,
                                                 HasChildren = false,
                                                 SortField = pipeComponentProperty.Name
                                             };
                        if (nodeView.ChildrenLoaded)
                        {
                            nodeView.Children.Add(child);
                            nodeView.Sort();
                        }
                        mCmsWebServiceClient.AddPipePropertyCompleted -= addCompleted;
                    };

                    mCmsWebServiceClient.AddPipePropertyCompleted += addCompleted;
                    mCmsWebServiceClient.AddPipePropertyAsync(dialog.ComponentProperty as PipeProperty);
                }
            };
        }
Esempio n. 7
0
        private void EditPipeProperty(NodeView nodeView)
        {
            EventHandler<GetPipePropertyCompletedEventArgs> getPipePropertyCompleted = null;

            //***********************************
            //The first thing we need to do is setup the handler for loading Pipe Component Property
            //We are doing this inline because we need reference to nodeView
            getPipePropertyCompleted = (s, eventArgs) =>
            {
                PipeProperty pipeProperty = eventArgs.Result;

                //Show Add Pipe Component Property dialog
                AddEditEquipmentPropertyDialog dialog = new AddEditEquipmentPropertyDialog(CommonUtils.EquipmentPropertyType.PipeProperty, pipeProperty.Id);
                dialog.Show();

                //Handler for closing the Add Pipe Component Property dialog
                dialog.Closed += (s1, e1) =>
                {
                    //Start event handler for closed dialog
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        //Set up handler that will save pipe component property
                        EventHandler<AddPipePropertyCompletedEventArgs> addCompleted = null;
                        addCompleted = (s2, e2) =>
                        {
                            //Update node view
                            PipeProperty pipeComponentProperty = e2.Result as PipeProperty;
                            nodeView.Name = pipeComponentProperty.Name;
                            nodeView.Description = pipeComponentProperty.Description;
                            nodeView.SortField = pipeComponentProperty.Name;

                            mCmsWebServiceClient.AddPipePropertyCompleted -= addCompleted;
                            nodeView.Sort();
                        };

                        mCmsWebServiceClient.AddPipePropertyCompleted += addCompleted;
                        mCmsWebServiceClient.AddPipePropertyAsync(dialog.ComponentProperty as PipeProperty);
                    }
                    //finish closed event handler

                };
                mCmsWebServiceClient.GetPipePropertyCompleted -= getPipePropertyCompleted;
            };
            //End of the setup of events section.
            //***********************************

            //Setup the event / handler links
            mCmsWebServiceClient.GetPipePropertyCompleted += getPipePropertyCompleted;
            mCmsWebServiceClient.GetPipePropertyAsync(nodeView.Id);
        }