Пример #1
0
        /// <summary>
        /// KNXSwitch 转 SwitchNode
        /// </summary>
        /// <param name="knx"></param>
        public SwitchNode(KNXSwitch knx)
            : base(knx)
        {
            this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxSwitchType;

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

            this.ImageOn  = knx.ImageOn;
            this.ColorOn  = FrmMainHelp.HexStrToColor(knx.ColorOn);  // knx.ColorOn;
            this.ImageOff = knx.ImageOff;
            this.ColorOff = FrmMainHelp.HexStrToColor(knx.ColorOff); //knx.ColorOff;
        }
Пример #2
0
        public SceneButtonNode(KNXSceneButton knx)
            : base(knx)
        {
            this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxSceneButtonType;

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

            this.ImageOn      = knx.ImageOn;
            this.ColorOn      = FrmMainHelp.HexStrToColor(knx.ColorOn);  // knx.ColorOn;
            this.ImageOff     = knx.ImageOff;
            this.ColorOff     = FrmMainHelp.HexStrToColor(knx.ColorOff); // knx.ColorOff;
            this.IsGroup      = (EBool)Enum.ToObject(typeof(EBool), knx.IsGroup);
            this.DefaultValue = knx.DefaultValue;
        }
Пример #3
0
        /// <summary>
        /// SwitchNode 转 KNXSwitch
        /// </summary>
        /// <returns></returns>
        public KNXSwitch ToKnx()
        {
            var knx = new KNXSwitch();

            base.ToKnx(knx);

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

            knx.ImageOn  = this.ImageOn;
            knx.ColorOn  = FrmMainHelp.ColorToHexStr(this.ColorOn);  // this.ColorOn;
            knx.ImageOff = this.ImageOff;
            knx.ColorOff = FrmMainHelp.ColorToHexStr(this.ColorOff); //this.ColorOff;

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

            base.ToKnx(knx);

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

            knx.ImageOn      = this.ImageOn;
            knx.ColorOn      = FrmMainHelp.ColorToHexStr(this.ColorOn);  // this.ColorOn;
            knx.ImageOff     = this.ImageOff;
            knx.ColorOff     = FrmMainHelp.ColorToHexStr(this.ColorOff); // this.ColorOff;
            knx.IsGroup      = (int)this.IsGroup;
            knx.DefaultValue = this.DefaultValue;

            return(knx);
        }
Пример #6
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);
        }
Пример #7
0
 /// <summary>
 /// ViewNode 转 KNXView
 /// </summary>
 /// <param name="knx"></param>
 protected void ToKnx(KNXView knx)
 {
     knx.Id     = this.Id;
     knx.Text   = this.Text;
     knx.Left   = this.X;
     knx.Top    = this.Y;
     knx.Width  = this.Width;
     knx.Height = this.Height;
     //knx.Left = this.Location.X;
     //knx.Top = this.Location.Y;
     //knx.Width = this.Size.Width;
     //knx.Height = this.Size.Height;
     knx.DisplayBorder   = (int)this.DisplayBorder;
     knx.BorderColor     = FrmMainHelp.ColorToHexStr(this.BorderColor);
     knx.Alpha           = this.Alpha;
     knx.Radius          = this.Radius;
     knx.FlatStyle       = (int)this.FlatStyle;
     knx.BackgroundColor = FrmMainHelp.ColorToHexStr(this.BackgroundColor);
     knx.BackgroundImage = this.BackgroundImage;
     knx.FontColor       = FrmMainHelp.ColorToHexStr(this.FontColor);
     knx.FontSize        = this.FontSize;
 }
Пример #8
0
        /// <summary>
        /// KNXView 转 ViewNode
        /// </summary>
        /// <param name="knx"></param>
        public ViewNode(KNXView knx)
        {
            this.Id     = knx.Id;
            this.Text   = knx.Text;
            this.X      = knx.Left;
            this.Y      = knx.Top;
            this.Width  = knx.Width;
            this.Height = knx.Height;
            //this.Location = new Point(knx.Left, knx.Top);
            //this.Size = new Size(knx.Width, knx.Height);
            this.DisplayBorder   = (EBool)Enum.ToObject(typeof(EBool), knx.DisplayBorder);
            this.BorderColor     = FrmMainHelp.HexStrToColor(knx.BorderColor);
            this.Alpha           = knx.Alpha;
            this.Radius          = knx.Radius;
            this.FlatStyle       = (EFlatStyle)Enum.ToObject(typeof(EFlatStyle), knx.FlatStyle);
            this.BackgroundColor = FrmMainHelp.HexStrToColor(knx.BackgroundColor ?? "#FFFFFF");
            this.BackgroundImage = knx.BackgroundImage;
            this.FontColor       = FrmMainHelp.HexStrToColor(knx.FontColor ?? "#000000");
            this.FontSize        = knx.FontSize;

            this.State = ControlState.Normal;
        }