public override object Copy() { SceneButtonNode node = base.Copy() as SceneButtonNode; node.SetText(node.Title); return(node); }
public override object Clone() { SceneButtonNode node = base.Clone() as SceneButtonNode; 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.ImageOn = this.ImageOn; node.ColorOn = this.ColorOn; node.ImageOff = this.ImageOff; node.ColorOff = this.ColorOff; node.IsGroup = this.IsGroup; node.DefaultValue = this.DefaultValue; return(node); }
/// <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; } }