Пример #1
0
        public KNXDigitalAdjustment ExportTo(BackgroundWorker worker, string dir, Point RelPoint)
        {
            KNXDigitalAdjustment 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);
        }
        public DigitalAdjustmentNode(KNXDigitalAdjustment knx)
            : base(knx)
        {
            this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxDigitalAdjustment;

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

            this.LeftImage     = knx.LeftImage;
            this.RightImage    = knx.RightImage;
            this.DigitalNumber = (KNXDigitalAdjustment.EDigitalNumber)Enum.ToObject(typeof(KNXDigitalAdjustment.EDigitalNumber), knx.DigitalNumber);
            this.MaxValue      = knx.MaxValue;
            this.MinValue      = knx.MinValue;
            this.Unit          = (EMeasurementUnit)Enum.ToObject(typeof(EMeasurementUnit), knx.Unit);
        }
        public KNXDigitalAdjustment ToKnx()
        {
            var knx = new KNXDigitalAdjustment();

            base.ToKnx(knx);

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

            knx.LeftImage     = this.LeftImage;
            knx.RightImage    = this.RightImage;
            knx.DigitalNumber = (int)this.DigitalNumber;
            knx.MaxValue      = this.MaxValue;
            knx.MinValue      = this.MinValue;
            knx.Unit          = (int)this.Unit;

            return(knx);
        }
Пример #4
0
        public DigitalAdjustmentNode(KNXDigitalAdjustment 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));
            }
        }
Пример #5
0
        public KNXDigitalAdjustment ToKnx(BackgroundWorker worker)
        {
            var knx = new KNXDigitalAdjustment();

            base.ToKnx(knx, worker);

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

            knx.LeftImage  = this.LeftImage;
            knx.RightImage = this.RightImage;

            knx.DecimalDigit   = (int)this.DecimalDigit;
            knx.MaxValue       = this.MaxValue;
            knx.MinValue       = this.MinValue;
            knx.RegulationStep = this.RegulationStep.GetDescription();
            knx.Unit           = (int)this.Unit;
            knx.ValueFont      = this.ValueFont.ToKnx();

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

            return(knx);
        }
Пример #6
0
        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);
            }
        }