Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        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>
        /// KNXImageButton 转 ImageButtonNode
        /// </summary>
        /// <param name="knx"></param>
        public ImageButtonNode(KNXImageButton knx, BackgroundWorker worker)
            : base(knx, worker)
        {
            this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxImageButtonType;

            SetText(this.Title);

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

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

            if (ImportedHelper.IsLessThan2_7_1())
            {
                this.Alpha = .0f;
            }
        }
        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;
            }
        }
Esempio n. 5
0
        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();
        }
        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));
            }
        }
Esempio n. 7
0
        public PageNode(KNXPage 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.BackgroundImage = ProjResManager.CopyImageRename(Path.Combine(knxImagePath, NAME_BACKGROUNDIMAGE));
            }
            else
            {
                this.BackgroundImage = ProjResManager.CopyImageRename(Path.Combine(DirSrcImg, knx.BackgroundImage));
            }
        }
Esempio n. 8
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;
        }
Esempio n. 9
0
        public AreaNode(KNXArea knx, BackgroundWorker worker)
            : base(knx, worker)
        {
            this.Name = ImageKey = SelectedImageKey = MyConst.View.KnxAreaType;
            SetText(this.Title);

            //this.Symbol = ImageHelper.GetDiskImage(Path.Combine(this.ImagePath, NAME_SYMBOL));
            this.PinCode = knx.PinCode;

            if (ImportedHelper.IsLessThan2_5_6())
            {
                this.Symbol = ProjResManager.CopyImageSole(Path.Combine(this.ImagePath, NAME_SYMBOL));
            }
            else
            {
                this.Symbol = knx.Symbol;
            }
        }
Esempio n. 10
0
        public SwitchNode(KNXSwitch 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.ImageOn  = ProjResManager.CopyImageRename(Path.Combine(knxImagePath, NAME_IMAGEON));
                this.ImageOff = ProjResManager.CopyImageRename(Path.Combine(knxImagePath, NAME_IMAGEOFF));
            }
            else
            {
                this.ImageOn  = ProjResManager.CopyImageRename(Path.Combine(DirSrcImg, knx.ImageOn));
                this.ImageOff = ProjResManager.CopyImageRename(Path.Combine(DirSrcImg, knx.ImageOff));
            }
        }
Esempio n. 11
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));
            }
        }
Esempio n. 12
0
        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;
        }
Esempio n. 13
0
        /// <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;
            }
        }
Esempio n. 14
0
        public AreaNode(KNXArea knx, BackgroundWorker worker, string DirSrcImg)
            : this(knx, worker)
        {
            this.Id = GenId(); // 创建新的Id

            //string knxImage = GetImageName(knx.Id); // KNX图片资源名称
            //string knxImagePath = Path.Combine(DirSrcImg, knxImage); // KNX图片资源路径
            //FileHelper.CopyFolderContent(knxImagePath, this.ImagePath, true); // 拷贝KNX图片资源

            //this.Symbol = ImageHelper.GetDiskImage(Path.Combine(this.ImagePath, NAME_SYMBOL));
            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));
            }
        }
Esempio n. 15
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);
            }
        }