Esempio n. 1
0
        public override object Copy()
        {
            BlindsNode node = base.Copy() as BlindsNode;

            node.SetText(node.Title);
            return(node);
        }
Esempio n. 2
0
        public override object Clone()
        {
            BlindsNode node = base.Clone() as BlindsNode;

            node.ReadAddressId = new Dictionary <string, KNXSelectedAddress>();
            foreach (var item in this.ReadAddressId)
            {
                node.ReadAddressId.Add(item.Key, item.Value);
            }
            node.WriteAddressIds = new Dictionary <string, KNXSelectedAddress>();
            foreach (var item in this.WriteAddressIds)
            {
                node.WriteAddressIds.Add(item.Key, item.Value);
            }

            node.LeftImage          = this.LeftImage;
            node.LeftText           = this.LeftText;
            node.LeftTextFontSize   = this.LeftTextFontSize;
            node.LeftTextFontColor  = this.LeftTextFontColor;
            node.RightImage         = this.RightImage;
            node.RightText          = this.RightText;
            node.RightTextFontSize  = this.RightTextFontSize;
            node.RightTextFontColor = this.RightTextFontColor;

            return(node);
        }
Esempio n. 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;
            }
        }