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;
            }
        }
Example #2
0
        public TimerButtonNode(KNXTimerButton knx)
            : base(knx)
        {
            this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxTimerButtonType;

            this.ReadAddressId   = knx.ReadAddressId ?? new Dictionary <string, KNXSelectedAddress>();
            this.WriteAddressIds = knx.WriteAddressIds ?? new Dictionary <string, KNXSelectedAddress>();
        }
Example #3
0
        public KNXTimerButton ToKnx()
        {
            var knx = new KNXTimerButton();

            base.ToKnx(knx);

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

            return(knx);
        }
        public KNXTimerButton ExportTo(BackgroundWorker worker, string dir, Point RelPoint)
        {
            KNXTimerButton 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.Symbol = FileHelper.CopyFileSole(Path.Combine(MyCache.ProjImgPath, this.Symbol), dir);

            return(knx);
        }
        public KNXTimerButton ToKnx(BackgroundWorker worker)
        {
            var knx = new KNXTimerButton();

            base.ToKnx(knx, worker);

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


            MyCache.ValidResImgNames.Add(knx.Symbol);

            return(knx);
        }
        public TimerButtonNode(KNXTimerButton 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.Symbol = ProjResManager.CopyImageRename(Path.Combine(knxImagePath, NAME_SYMBOL));
            }
            else
            {
                this.Symbol = ProjResManager.CopyImageRename(Path.Combine(DirSrcImg, knx.Symbol));
            }
        }