Exemple #1
0
        private void EditShaft(object para)
        {
            DeviceTreeItemViewModel devicemodel = para as DeviceTreeItemViewModel;

            if (devicemodel != null && devicemodel.DeviceDiagnoseComponent != null && devicemodel.DeviceDiagnoseComponent.Component.SelectedShaft != null && devicemodel.DeviceDiagnoseComponent.Component.SelectedShaft.Component != null && devicemodel.DeviceDiagnoseComponent.Component.SelectedShaft.Component.MachComponents.Count == 0)
            {
                BearingComponent bear = NewComponent();
                devicemodel.DeviceDiagnoseComponent.Component.SelectedShaft.Component.AddBearingComponent(bear);
                devicemodel.DeviceDiagnoseComponent.Component.SelectedShaft.Component.SelectedComponent = bear;

                ComponentSelectionChanged(devicemodel.DeviceDiagnoseComponent.Component.SelectedShaft);
            }
            else
            {
                ShaftSelectionChanged(para);
            }
        }
Exemple #2
0
        private void ChangedComponentType()
        {
            IMachComponent component = null;

            switch (ComponentType)
            {
            case DeviceComponentType.Bearing:
            {
                component = new BearingComponent()
                {
                    Component = new BearingClass()
                    {
                        Guid = Guid.NewGuid()
                    }, Guid = Guid.NewGuid(), Name = "新建轴承"
                };
                break;
            }

            case DeviceComponentType.Belt:
            {
                component = new BeltComponent()
                {
                    Component = new BeltClass(), Guid = Guid.NewGuid(), Name = "新建皮带"
                };
                break;
            }

            case DeviceComponentType.Gear:
            {
                component = new GearComponent()
                {
                    Component = new GearClass(), Guid = Guid.NewGuid(), Name = "新建齿轮"
                };
                break;
            }

            case DeviceComponentType.Impeller:
            {
                component = new ImpellerComponent()
                {
                    Component = new ImpellerClass(), Guid = Guid.NewGuid(), Name = "新建叶轮"
                };
                break;
            }

            case DeviceComponentType.Motor:
            {
                component = new MotorComponent()
                {
                    Component = new MotorClass(), Guid = Guid.NewGuid(), Name = "新建电机"
                };
                break;
            }
            }
            if (component != null)
            {
                //ComponentType = component.ComponentType;
                var oldcomponent = selectedshaft.Component.SelectedComponent;
                int index        = selectedshaft.Component.MachComponents.IndexOf(oldcomponent);
                selectedshaft.Component.MachComponents.Insert(index, component);
                selectedshaft.Component.MachComponents.Remove(oldcomponent);
                selectedshaft.Component.SelectedComponent = component;
            }
        }
Exemple #3
0
        private void AddComponent()
        {
            IMachComponent component = null;

            switch (ComponentType)
            {
            case DeviceComponentType.Bearing:
            {
                component = new BearingComponent()
                {
                    Component = new BearingClass()
                    {
                        Guid = Guid.NewGuid()
                    }, Guid = Guid.NewGuid(), Name = "新建轴承"
                };
                BearingComponent = component as BearingComponent;
                break;
            }

            case DeviceComponentType.Belt:
            {
                component = new BeltComponent()
                {
                    Component = new BeltClass(), Guid = Guid.NewGuid(), Name = "新建皮带"
                };
                BeltComponent = component as BeltComponent;
                break;
            }

            case DeviceComponentType.Gear:
            {
                component = new GearComponent()
                {
                    Component = new GearClass(), Guid = Guid.NewGuid(), Name = "新建齿轮"
                };
                GearComponent = component as GearComponent;
                break;
            }

            case DeviceComponentType.Impeller:
            {
                component = new ImpellerComponent()
                {
                    Component = new ImpellerClass(), Guid = Guid.NewGuid(), Name = "新建叶轮"
                };
                ImpellerComponent = component as ImpellerComponent;
                break;
            }

            case DeviceComponentType.Motor:
            {
                component = new MotorComponent()
                {
                    Component = new MotorClass(), Guid = Guid.NewGuid(), Name = "新建电机"
                };
                MotorComponent = component as MotorComponent;
                break;
            }
            }
            if (component != null)
            {
                selectedshaft.Component.MachComponents.Add(component);
                selectedshaft.Component.SelectedComponent = component;
            }
        }