Ejemplo n.º 1
0
 /// <summary>
 /// KNXControlBase 转 ControlBaseNode
 /// </summary>
 /// <param name="knx"></param>
 public ControlBaseNode(KNXControlBase knx)
     : base(knx)
 {
     //    this.ReadAddressId = knx.ReadAddressId ?? new Dictionary<string, KNXSelectedAddress>();
     //    this.WriteAddressIds = knx.WriteAddressIds ?? new Dictionary<string, KNXSelectedAddress>();
     this.HasTip = (EBool)Enum.ToObject(typeof(EBool), knx.HasTip);
     this.Tip = knx.Tip;
     this.Clickable = (EBool)Enum.ToObject(typeof(EBool), knx.Clickable);
     this.Icon = knx.Icon;
 }
Ejemplo n.º 2
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;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// ControlBaseNode 转 KNXControlBase
        /// </summary>
        /// <param name="knx"></param>
        public void ToKnx(KNXControlBase knx)
        {
            base.ToKnx(knx);

            //knx.ReadAddressId = this.ReadAddressId;
            //knx.WriteAddressIds = this.WriteAddressIds;
            knx.HasTip = (int)this.HasTip;
            knx.Tip = this.Tip;
            knx.Clickable = (int)this.Clickable;
            knx.Icon = this.Icon;
        }