Example #1
0
        public FrmShutter(ShutterNode node)
        {
            InitializeComponent();

            this.Text = node.Title + "-" + this.Text;

            this.ckbShutterUpDown.Checked         = this.tlpShutterUpDown.Enabled = node.ShutterUpDown.Enable;
            this.ckbShutterStop.Checked           = this.tlpShutterStop.Enabled = node.ShutterStop.Enable;
            this.ckbPositionShutter.Checked       = this.tlpPositionShutter.Enabled = node.AbsolutePositionOfShutter.Enable;
            this.ckbPositionBlinds.Checked        = this.tlpPositionBlinds.Enabled = node.AbsolutePositionOfBlinds.Enable;
            this.ckbStateUpperPosition.Checked    = this.tlpStateUpperPosition.Enabled = node.StateUpperPosition.Enable;
            this.ckbStateLowerPosition.Checked    = this.tlpStateLowerPosition.Enabled = node.StateLowerPosition.Enable;
            this.ckbStatusPositionShutter.Checked = this.tlpStatusPositionShutter.Enabled = node.StatusActualPositionOfShutter.Enable;
            this.ckbStatusPositionBlinds.Checked  = this.tlpStatusPositionBlinds.Enabled = node.StatusActualPositionOfBlinds.Enable;

            this.gaShutterUpDown         = new Dictionary <string, KNXSelectedAddress>(node.ShutterUpDown.MapSelectedAddress);
            this.gaShutterStop           = new Dictionary <string, KNXSelectedAddress>(node.ShutterStop.MapSelectedAddress);
            this.gaPositionShutter       = new Dictionary <string, KNXSelectedAddress>(node.AbsolutePositionOfShutter.MapSelectedAddress);
            this.gaPositionBlinds        = new Dictionary <string, KNXSelectedAddress>(node.AbsolutePositionOfBlinds.MapSelectedAddress);
            this.gaStateUpperPosition    = new Dictionary <string, KNXSelectedAddress>(node.StateUpperPosition.MapSelectedAddress);
            this.gaStateLowerPosition    = new Dictionary <string, KNXSelectedAddress>(node.StateLowerPosition.MapSelectedAddress);
            this.gaStatusPositionShutter = new Dictionary <string, KNXSelectedAddress>(node.StatusActualPositionOfShutter.MapSelectedAddress);
            this.gaStatusPositionBlinds  = new Dictionary <string, KNXSelectedAddress>(node.StatusActualPositionOfBlinds.MapSelectedAddress);

            this.txbxShutterUpDown.Text         = KNXSelectedAddress.GetGroupAddressName(this.gaShutterUpDown);
            this.txbxShutterStop.Text           = KNXSelectedAddress.GetGroupAddressName(this.gaShutterStop);
            this.txbxPositionShutter.Text       = KNXSelectedAddress.GetGroupAddressName(this.gaPositionShutter);
            this.txbxPositionBlinds.Text        = KNXSelectedAddress.GetGroupAddressName(this.gaPositionBlinds);
            this.txbxStateUpperPosition.Text    = KNXSelectedAddress.GetGroupAddressName(this.gaStateUpperPosition);
            this.txbxStateLowerPosition.Text    = KNXSelectedAddress.GetGroupAddressName(this.gaStateLowerPosition);
            this.txbxStatusPositionShutter.Text = KNXSelectedAddress.GetGroupAddressName(this.gaStatusPositionShutter);
            this.txbxStatusPositionBlinds.Text  = KNXSelectedAddress.GetGroupAddressName(this.gaStatusPositionBlinds);

            this.node = node;
        }
        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);
        }