/// <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; }
/// <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; }