public TimerButtonNode(KNXTimerButton knx, BackgroundWorker worker) : base(knx, worker) { this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxTimerButtonType; SetText(this.Title); this.ReadAddressId = knx.ReadAddressId ?? new Dictionary <string, KNXSelectedAddress>(); this.WriteAddressIds = knx.WriteAddressIds ?? new Dictionary <string, KNXSelectedAddress>(); if (ImportedHelper.IsLessThan2_0_3()) { if (!string.IsNullOrEmpty(knx.Icon)) { this.Symbol = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.Icon)); } } else if (ImportedHelper.IsLessThan2_5_6()) { this.Symbol = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_SYMBOL)); } else { this.Symbol = knx.Symbol; } }
/// <summary> /// KNXSwitch 转 SwitchNode /// </summary> /// <param name="knx"></param> public SwitchNode(KNXSwitch knx, BackgroundWorker worker) : base(knx, worker) { this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxSwitchType; SetText(this.Title); this.ReadAddressId = knx.ReadAddressId ?? new Dictionary <string, KNXSelectedAddress>(); this.WriteAddressIds = knx.WriteAddressIds ?? new Dictionary <string, KNXSelectedAddress>(); if (ImportedHelper.IsLessThan2_0_3()) { if (!string.IsNullOrEmpty(knx.ImageOn)) { this.ImageOn = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.ImageOn)); } if (!string.IsNullOrEmpty(knx.ImageOff)) { this.ImageOff = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.ImageOff)); } } else if (ImportedHelper.IsLessThan2_5_6()) { this.ImageOn = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_IMAGEON)); this.ImageOff = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_IMAGEOFF)); } else { this.ImageOn = knx.ImageOn; this.ImageOff = knx.ImageOff; } this.ColorOn = ColorHelper.HexStrToColor(knx.ColorOn); this.ColorOff = ColorHelper.HexStrToColor(knx.ColorOff); }
public RoomNode(KNXRoom knx, BackgroundWorker worker) : base(knx, worker) { Name = ImageKey = SelectedImageKey = MyConst.View.KnxRoomType; SetText(this.Title); if (ImportedHelper.IsLessThan2_0_3()) { if (!string.IsNullOrEmpty(knx.Symbol)) { this.Symbol = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.Symbol)); //this.Symbol = ImageHelper.GetDiskImage(Path.Combine(this.ImagePath, knx.Symbol)); } } else if (ImportedHelper.IsLessThan2_5_6()) { this.Symbol = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_SYMBOL)); //this.Symbol = ImageHelper.GetDiskImage(Path.Combine(this.ImagePath, NAME_SYMBOL)); } else { this.Symbol = knx.Symbol; } PinCode = knx.PinCode; this.IsDefaultRoom = (EBool)Enum.ToObject(typeof(EBool), knx.DefaultRoom); }
/// <summary> /// KNXView 转 ViewNode /// </summary> /// <param name="knx"></param> public ViewNode(KNXView knx, BackgroundWorker worker) { this.Id = knx.Id; this.Text = knx.Text; if (ImportedHelper.IsLessThan2_0_3()) { this.Title = knx.Text; } else { this.Title = knx.Title; } if (null != worker) { worker.ReportProgress(0, string.Format(UIResMang.GetString("TextIsImporting"), this.Title)); } this.Location = new Point(knx.Left, knx.Top); this.Size = new Size(knx.Width, knx.Height); if (null != knx.Padding) { this.Padding = knx.Padding.ToPadding(); } else { this.Padding = new Padding(0); } this.DisplayBorder = (EBool)Enum.ToObject(typeof(EBool), knx.DisplayBorder); this.BorderColor = ColorHelper.HexStrToColor(knx.BorderColor); this.Alpha = knx.Alpha; this.Radius = knx.Radius; this.FlatStyle = (EFlatStyle)Enum.ToObject(typeof(EFlatStyle), knx.FlatStyle); this.BackgroundColor = ColorHelper.HexStrToColor(knx.BackgroundColor ?? "#FFFFFF"); this.BackgroundImage = knx.BackgroundImage; if (ImportedHelper.IsLessThan2_5_2()) { this.TitleFont = new STFont(knx.FontColor, knx.FontSize); } else { this.TitleFont = new STFont(knx.TitleFont); } this.State = ControlState.Normal; }
public AppNode(KNXApp knx, BackgroundWorker worker) : base(knx, worker) { this.Name = ImageKey = SelectedImageKey = MyConst.View.KnxAppType; SetText(this.Title); //MyCache.Width = this.Width; //MyCache.Height = this.Height; MyCache.AppSize = this.Size; this.About = knx.About; if (ImportedHelper.IsLessThan2_0_3()) { //this.Width = 1280; //this.Height = 800; this.Size = new Size(1280, 800); if (!string.IsNullOrEmpty(knx.Symbol)) { this.Symbol = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.Symbol)); } else if (!string.IsNullOrEmpty(knx.Logo)) { this.Symbol = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.Logo)); } if (!string.IsNullOrEmpty(knx.BackgroundImage)) { this.BackgroundImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.BackgroundImage)); } } else if (ImportedHelper.IsLessThan2_5_6()) { this.Symbol = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_SYMBOL)); this.BackgroundImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_BACKGROUNDIMAGE)); } else { //this.Width = knx.Width; //this.Height = knx.Height; this.Size = new Size(knx.Width, knx.Height); this.Symbol = knx.Symbol; this.BackgroundImage = knx.BackgroundImage; } GetProjectVersion(); }
/// <summary> /// 从工程文件中导入控件 /// </summary> /// <param name="knx"></param> public BlindsNode(KNXBlinds knx, BackgroundWorker worker) : base(knx, worker) { this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxBlindsType; SetText(this.Title); this.ReadAddressId = knx.ReadAddressId ?? new Dictionary <string, KNXSelectedAddress>(); this.WriteAddressIds = knx.WriteAddressIds ?? new Dictionary <string, KNXSelectedAddress>(); if (ImportedHelper.IsLessThan2_0_3()) { if (!string.IsNullOrEmpty(knx.LeftImage)) { this.LeftImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.LeftImage)); } if (!string.IsNullOrEmpty(knx.RightImage)) { this.RightImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.RightImage)); } } else if (ImportedHelper.IsLessThan2_5_6()) { this.LeftImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_LEFTIMAGE)); this.RightImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_RIGHTIMAGE)); } else { this.LeftImage = knx.LeftImage; this.RightImage = knx.RightImage; } if (ImportedHelper.IsLessThan2_5_2()) { this.LeftTextFont = new STFont(knx.LeftTextFontColor, knx.LeftTextFontSize); this.RightTextFont = new STFont(knx.RightTextFontColor, knx.RightTextFontSize); } else { this.LeftTextFont = new STFont(knx.LeftTextFont); this.RightTextFont = new STFont(knx.RightTextFont); } this.LeftText = knx.LeftText; this.RightText = knx.RightText; }
public SliderSwitchNode(KNXSliderSwitch knx, BackgroundWorker worker) : base(knx, worker) { this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxSliderSwitchType; SetText(this.Title); this.ReadAddressId = knx.ReadAddressId ?? new Dictionary <string, KNXSelectedAddress>(); this.WriteAddressIds = knx.WriteAddressIds ?? new Dictionary <string, KNXSelectedAddress>(); if (ImportedHelper.IsLessThan2_0_3()) { if (!string.IsNullOrEmpty(knx.LeftImage)) { this.LeftImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.LeftImage)); } if (!string.IsNullOrEmpty(knx.RightImage)) { this.RightImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.RightImage)); } if (!string.IsNullOrEmpty(knx.SliderImage)) { this.SliderImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.SliderImage)); } } else if (ImportedHelper.IsLessThan2_5_6()) { this.LeftImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_LEFTIMAGE)); this.RightImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_RIGHTIMAGE)); this.SliderImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_SLIDERIMAGE)); } else { this.LeftImage = knx.LeftImage; this.RightImage = knx.RightImage; this.SliderImage = knx.SliderImage; } this.IsRelativeControl = (EBool)Enum.ToObject(typeof(EBool), knx.IsRelativeControl); this.Orientation = (Orientation)Enum.ToObject(typeof(Orientation), knx.Orientation); this.SliderWidth = knx.SliderWidth < MIN_SLDER_WIDTH ? MIN_SLDER_WIDTH : knx.SliderWidth; }
/// <summary> /// PageNode 转 KNXPage /// </summary> /// <param name="knx"></param> public PageNode(KNXPage knx, BackgroundWorker worker) : base(knx, worker) { this.Name = ImageKey = SelectedImageKey = MyConst.View.KnxPageType; SetText(this.Title); if (ImportedHelper.IsLessThan2_0_3()) { if (!string.IsNullOrEmpty(knx.BackgroundImage)) { this.BackgroundImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.BackgroundImage)); } } else if (ImportedHelper.IsLessThan2_5_6()) { this.BackgroundImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_BACKGROUNDIMAGE)); } else { this.BackgroundImage = knx.BackgroundImage; } }
public DigitalAdjustmentNode(KNXDigitalAdjustment knx, BackgroundWorker worker) : base(knx, worker) { this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxDigitalAdjustmentType; SetText(this.Title); this.ReadAddressId = knx.ReadAddressId ?? new Dictionary <string, KNXSelectedAddress>(); this.WriteAddressIds = knx.WriteAddressIds ?? new Dictionary <string, KNXSelectedAddress>(); if (ImportedHelper.IsLessThan2_0_3()) { if (!string.IsNullOrEmpty(knx.LeftImage)) { this.LeftImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.LeftImage)); } if (!string.IsNullOrEmpty(knx.RightImage)) { this.RightImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, knx.RightImage)); } } else if (ImportedHelper.IsLessThan2_5_6()) { this.LeftImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_LEFTIMAGE)); this.RightImage = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_RIGHTIMAGE)); } else { this.LeftImage = knx.LeftImage; this.RightImage = knx.RightImage; } this.DecimalDigit = (EDecimalDigit)Enum.ToObject(typeof(EDecimalDigit), knx.DecimalDigit); this.MaxValue = knx.MaxValue; this.MinValue = knx.MinValue; if (ImportedHelper.IsLessThan2_1_8() && knx.Unit > (int)EMeasurementUnit.Centigrade) { this.Unit = (EMeasurementUnit)Enum.ToObject(typeof(EMeasurementUnit), knx.Unit - 1); } else { this.Unit = (EMeasurementUnit)Enum.ToObject(typeof(EMeasurementUnit), knx.Unit); } if (ImportedHelper.IsLessThan2_5_3()) { this.RegulationStep = ERegulationStep.One; } else { if (ImportedHelper.IsLessThan2_5_4()) { knx.RegStep += 2; this.RegulationStep = (ERegulationStep)Enum.ToObject(typeof(ERegulationStep), knx.RegStep); } else { this.RegulationStep = (ERegulationStep)EnumExtension.ConvertFrom(typeof(ERegulationStep), knx.RegulationStep); } } if (ImportedHelper.IsLessThan2_5_4()) { this.ValueFont = this.TitleFont.Clone(); } else { this.ValueFont = new STFont(knx.ValueFont); } }