private static ViewNode ImportControlNode(BackgroundWorker worker, ContainerNode parentNode, KNXControlBase knx, string ResImgDir)
        {
            ViewNode node = null;

            switch (knx.GetType().Name)
            {
            case MyConst.Controls.KnxBlindsType:
                node = new BlindsNode(knx as KNXBlinds, worker, ResImgDir);
                break;

            case MyConst.Controls.KnxLabelType:
                node = new LabelNode(knx as KNXLabel, worker, ResImgDir);
                break;

            case MyConst.Controls.KnxSceneButtonType:
                node = new SceneButtonNode(knx as KNXSceneButton, worker, ResImgDir);
                break;

            case MyConst.Controls.KnxSliderSwitchType:
                node = new SliderSwitchNode(knx as KNXSliderSwitch, worker, ResImgDir);
                break;

            case MyConst.Controls.KnxSwitchType:
                node = new SwitchNode(knx as KNXSwitch, worker, ResImgDir);
                break;

            case MyConst.Controls.KnxValueDisplayType:
                node = new ValueDisplayNode(knx as KNXValueDisplay, worker, ResImgDir);
                break;

            case MyConst.Controls.KnxTimerButtonType:
                node = new TimerButtonNode(knx as KNXTimerButton, worker, ResImgDir);
                break;

            case MyConst.Controls.KnxDigitalAdjustmentType:
                node = new DigitalAdjustmentNode(knx as KNXDigitalAdjustment, worker, ResImgDir);
                break;

            case MyConst.Controls.KnxImageButtonType:
                node = new ImageButtonNode(knx as KNXImageButton, worker, ResImgDir);
                break;

            case MyConst.Controls.KnxShutterType:
                node = new ShutterNode(knx as KNXShutter, worker, ResImgDir);
                break;

            case MyConst.Controls.KnxDimmerType:
                node = new DimmerNode(knx as KNXDimmer, worker, ResImgDir);
                break;

            case MyConst.Controls.KnxWebCamViewerType:
                node = new WebCamerNode(knx as KNXWebCamer, worker, ResImgDir);
                break;

            case MyConst.Controls.KnxMediaButtonType:
                node = new MediaButtonNode(knx as KNXMediaButton, worker, ResImgDir);
                break;

            case MyConst.Controls.KnxAirConditionType:
                node = new AirConditionNode(knx as KNXAirCondition, worker, ResImgDir);
                break;

            case MyConst.Controls.KnxHVACType:
                node = new HVACNode(knx as KNXHVAC, worker, ResImgDir);
                break;

            case MyConst.Controls.KnxGroupBoxType:
                node = new GroupBoxNode(knx as KNXGroupBox, worker, ResImgDir);

                KNXGroupBox knxGroupBox = knx as KNXGroupBox;
                if (knxGroupBox.Controls != null && knxGroupBox.Controls.Count > 0)
                {
                    foreach (var item in knxGroupBox.Controls)
                    {
                        ImportControlNode(worker, node as ContainerNode, item, ResImgDir);
                    }
                }

                break;

            default:
                MessageBox.Show(UIResMang.GetString("Message39") + knx.GetType().Name, UIResMang.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;
            }

            if (null != parentNode)
            {
                parentNode.Nodes.Add(node);
            }

            return(node);
        }
Example #2
0
 public STContainer(ContainerNode node)
     : base(node)
 {
 }
Example #3
0
        /// <summary>
        /// 按 KNX 控件类型,给树上添加控件节点
        /// </summary>
        /// <param name="parentNode"></param>
        /// <param name="knxControl"></param>
        private static void AddControlNode(ContainerNode parentNode, KNXControlBase knxControl/*, UIEditor.Entity.ViewNode.PropertiesChangedDelegate proChangedDelegate*/)
        {
            switch (knxControl.GetType().Name)
            {
                case MyConst.Controls.KnxBlindsType:
                    var blindsNode = new BlindsNode(knxControl as KNXBlinds);
                    //blindsNode.PropertiesChangedEvent += proChangedDelegate;
                    parentNode.Nodes.Add(blindsNode);
                    break;

                case MyConst.Controls.KnxLabelType:
                    var labelNode = new LabelNode(knxControl as KNXLabel);
                    //labelNode.PropertiesChangedEvent += proChangedDelegate;
                    parentNode.Nodes.Add(labelNode);
                    break;

                case MyConst.Controls.KnxSceneButtonType:
                    var sceneButtonNode = new SceneButtonNode(knxControl as KNXSceneButton);
                    //sceneButtonNode.PropertiesChangedEvent += proChangedDelegate;
                    parentNode.Nodes.Add(sceneButtonNode);
                    break;

                case MyConst.Controls.KnxSliderSwitchType:
                    var sliderSwitchNode = new SliderSwitchNode(knxControl as KNXSliderSwitch);
                    //sliderSwitchNode.PropertiesChangedEvent += proChangedDelegate;
                    parentNode.Nodes.Add(sliderSwitchNode);
                    break;

                case MyConst.Controls.KnxSwitchType:
                    var switchNode = new SwitchNode(knxControl as KNXSwitch);
                    //switchNode.PropertiesChangedEvent += proChangedDelegate;
                    parentNode.Nodes.Add(switchNode);
                    break;

                case MyConst.Controls.KnxValueDisplayType:
                    var valueDisplayNode = new ValueDisplayNode(knxControl as KNXValueDisplay);
                    //valueDisplayNode.PropertiesChangedEvent += proChangedDelegate;
                    parentNode.Nodes.Add(valueDisplayNode);
                    break;

                case MyConst.Controls.KnxTimerButtonType:
                    var timerButton = new TimerButtonNode(knxControl as KNXTimerButton);
                    //timerButton.PropertiesChangedEvent += proChangedDelegate;
                    parentNode.Nodes.Add(timerButton);
                    break;

                case MyConst.Controls.KnxDigitalAdjustment:
                    var digitalAdjustment = new DigitalAdjustmentNode(knxControl as KNXDigitalAdjustment);
                    //digitalAdjustment.PropertiesChangedEvent += proChangedDelegate;
                    parentNode.Nodes.Add(digitalAdjustment);
                    break;

                case MyConst.Controls.KnxGroupBoxType:
                    var groupBox = new GroupBoxNode(knxControl as KNXGroupBox);
                    //groupBox.PropertiesChangedEvent += proChangedDelegate;
                    parentNode.Nodes.Add(groupBox);

                    KNXGroupBox knxGroupBox = knxControl as KNXGroupBox;
                    if (knxGroupBox.Controls != null && knxGroupBox.Controls.Count > 0)
                    {
                        foreach (var item in knxGroupBox.Controls)
                        {
                            AddControlNode(groupBox, item/*, proChangedDelegate*/);
                        }
                    }

                    break;

                default:
                    MessageBox.Show(ResourceMng.GetString("Message39") + knxControl.GetType().Name, ResourceMng.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;
            }
        }