Exemplo n.º 1
0
        public KNXBlinds ExportTo(BackgroundWorker worker, string dir, Point RelPoint)
        {
            KNXBlinds knx = this.ToKnx(worker);

            knx.Left = this.LocationInPageFact.X - RelPoint.X;
            knx.Top  = this.LocationInPageFact.Y - RelPoint.Y;

            knx.ReadAddressId.Clear();
            knx.WriteAddressIds.Clear();

            knx.LeftImage  = FileHelper.CopyFileSole(Path.Combine(MyCache.ProjImgPath, this.LeftImage), dir);
            knx.RightImage = FileHelper.CopyFileSole(Path.Combine(MyCache.ProjImgPath, this.RightImage), dir);

            return(knx);
        }
Exemplo n.º 2
0
        /// <summary>
        /// KNXBlinds 转 BlindsNode
        /// </summary>
        /// <param name="knx"></param>
        public BlindsNode(KNXBlinds knx)
            : base(knx)
        {
            this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxBlindsType;

            this.ReadAddressId   = knx.ReadAddressId ?? new Dictionary <string, KNXSelectedAddress>();
            this.WriteAddressIds = knx.WriteAddressIds ?? new Dictionary <string, KNXSelectedAddress>();

            this.LeftImage          = knx.LeftImage;
            this.LeftText           = knx.LeftText;
            this.LeftTextFontSize   = knx.LeftTextFontSize;
            this.LeftTextFontColor  = FrmMainHelp.HexStrToColor(knx.LeftTextFontColor); //knx.LeftTextFontColor;
            this.RightImage         = knx.RightImage;
            this.RightText          = knx.RightText;
            this.RightTextFontSize  = knx.RightTextFontSize;
            this.RightTextFontColor = FrmMainHelp.HexStrToColor(knx.RightTextFontColor);// knx.RightTextFontColor;
        }
Exemplo n.º 3
0
        /// <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;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 从模板中导入控件
        /// </summary>
        /// <param name="knx"></param>
        /// <param name="worker"></param>
        /// <param name="DirSrcImg"></param>
        public BlindsNode(KNXBlinds knx, BackgroundWorker worker, string DirSrcImg)
            : this(knx, worker)
        {
            this.Id = GenId(); // 创建新的Id

            if (ImportedHelper.IsLessThan2_5_6())
            {
                string knxImage     = GetImageName(knx.Id);              // KNX图片资源名称
                string knxImagePath = Path.Combine(DirSrcImg, knxImage); // KNX图片资源路径

                this.LeftImage  = ProjResManager.CopyImageRename(Path.Combine(knxImagePath, NAME_LEFTIMAGE));
                this.RightImage = ProjResManager.CopyImageRename(Path.Combine(knxImagePath, NAME_RIGHTIMAGE));
            }
            else
            {
                this.LeftImage  = ProjResManager.CopyImageRename(Path.Combine(DirSrcImg, knx.LeftImage));
                this.RightImage = ProjResManager.CopyImageRename(Path.Combine(DirSrcImg, knx.RightImage));
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// BlindsNode 转 KNXBlinds
        /// </summary>
        /// <returns></returns>
        public KNXBlinds ToKnx()
        {
            var knx = new KNXBlinds();

            base.ToKnx(knx);

            knx.ReadAddressId   = this.ReadAddressId;
            knx.WriteAddressIds = this.WriteAddressIds;

            knx.LeftImage          = this.LeftImage;
            knx.LeftText           = this.LeftText;
            knx.LeftTextFontSize   = this.LeftTextFontSize;
            knx.LeftTextFontColor  = FrmMainHelp.ColorToHexStr(this.LeftTextFontColor);// this.LeftTextFontColor;
            knx.RightImage         = this.RightImage;
            knx.RightText          = this.RightText;
            knx.RightTextFontSize  = this.RightTextFontSize;
            knx.RightTextFontColor = FrmMainHelp.ColorToHexStr(this.RightTextFontColor);// this.RightTextFontColor;

            return(knx);
        }
Exemplo n.º 6
0
        /// <summary>
        /// BlindsNode 转 KNXBlinds
        /// </summary>
        /// <returns></returns>
        public KNXBlinds ToKnx(BackgroundWorker worker)
        {
            var knx = new KNXBlinds();

            base.ToKnx(knx, worker);

            knx.ReadAddressId   = this.ReadAddressId;
            knx.WriteAddressIds = this.WriteAddressIds;

            knx.LeftImage    = this.LeftImage;
            knx.LeftText     = this.LeftText;
            knx.LeftTextFont = this.LeftTextFont.ToKnx();

            knx.RightImage    = this.RightImage;
            knx.RightText     = this.RightText;
            knx.RightTextFont = this.RightTextFont.ToKnx();

            MyCache.ValidResImgNames.Add(knx.LeftImage);
            MyCache.ValidResImgNames.Add(knx.RightImage);

            return(knx);
        }