wxr
2023-08-09 a7debf97f52b5f473c3316ecd06bf48f44b65406
HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs
@@ -354,6 +354,7 @@
                {
                    var d = new Dictionary<string, string>();
                    d.Add(FunctionAttributeKey.Brightness, e.ToString());
                    d.Add(FunctionAttributeKey.OnOff, e == 0 ? "off" : "on");
                    function.Control(d);
                }
                else
@@ -453,6 +454,7 @@
                {
                    var d = new Dictionary<string, string>();
                    d.Add(FunctionAttributeKey.Brightness, e.ToString());
                    d.Add(FunctionAttributeKey.OnOff, e == 0 ? "off" : "on");
                    function.Control(d);
                }
                else
@@ -626,10 +628,10 @@
                ColorImagePath = "FunctionIcon/Light/ColorWheel.png",
            };
            framePickerBack.AddChidren(colorPicker);
            //if (function.trait_on_off.curValue.ToString() == "off")
            //{
            //    colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheelGray.png";
            //}
            if (function.trait_on_off.curValue.ToString() == "off")
            {
                colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheelGray.png";
            }
            //colorPicker.MouseDownEventHandler = (sender, e) => {
            //    MainPage.BasePageView.ScrollEnabled = false;
            //};
@@ -675,11 +677,12 @@
            colorPicker.MouseDownEventHandler += (sender, e) =>
            {
                pointIsRight = this.CheckPoint(circleR, colorPicker.Width / 2, colorPicker.Height / 2, (int)e.X, (int)e.Y);
                if (pointIsRight == false)
                if (function.trait_on_off.curValue.ToString() == "off" || pointIsRight == false)
                {
                    //点的区域不是圆盘内
                    //pointIsRight:点的区域不是圆盘内
                    return;
                }
                //显示白点
                btnWhiteRound.X = (int)e.X - btnWhiteRound.Width / 2;
                btnWhiteRound.Y = (int)e.Y - btnWhiteRound.Height / 2;
@@ -694,8 +697,6 @@
                //当鼠标点下事件处理
                colorPicker.MouseDownEventHandler(sender, e);
            };
            #region 亮度调节
            var btnBrightnessText = new Button()
@@ -760,6 +761,7 @@
                {
                    var d = new Dictionary<string, string>();
                    d.Add(FunctionAttributeKey.Brightness, e.ToString());
                    d.Add(FunctionAttributeKey.OnOff, e == 0 ? "off" : "on");
                    function.Control(d);
                }
                else
@@ -776,10 +778,22 @@
                        { IsBackground = true }.Start();
                    }
                }
                btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100);
                btnBrightnessText.Text = dimmerBar.Progress + "%";
                if (e == 0)
                {
                    if (function.trait_on_off.curValue.ToString() == "on")
                    {
                        function.SetAttrState(FunctionAttributeKey.OnOff, "off");
                        colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheelGray.png";
                    }
                }
                else
                {
                    if (function.trait_on_off.curValue.ToString() == "off")
                    {
                        function.SetAttrState(FunctionAttributeKey.OnOff, "on");
                        colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheel.png";
                    }
                }
            };
@@ -800,10 +814,14 @@
                if (btnSwitch.IsSelected)
                {
                    dimmerBar.Progress = 100;
                    function.SetAttrState(FunctionAttributeKey.OnOff, "on");
                    colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheel.png";
                }
                else
                {
                    dimmerBar.Progress = 0;
                    function.SetAttrState(FunctionAttributeKey.OnOff, "off");
                    colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheelGray.png";
                }
            };
            #endregion
@@ -895,7 +913,7 @@
                //6500K
                var btnTempClolorMax = new Button();
                btnTempClolorMax.Y = btnTempClolorMin.Y;
                btnTempClolorMax.X = barColorTemplatrue.Right - Application.GetRealWidth(30);
                btnTempClolorMax.X = barColorTemplatrue.Right - Application.GetRealWidth(15);
                btnTempClolorMax.Width = Application.GetRealWidth(54);
                btnTempClolorMax.Height = Application.GetRealHeight(21);
                btnTempClolorMax.Text = "6500K";
@@ -906,9 +924,7 @@
                #endregion
                heightMore = 70;
            }
            if (hadColorful)
@@ -979,8 +995,7 @@
                            function.SetAttrState(FunctionAttributeKey.Colorful, controlColorfulState);
                            var d = new Dictionary<string, string>();
                            d.Add(FunctionAttributeKey.Colorful, controlColorfulState);
                            Control.Ins.SendWriteCommand(function, d);
                            function.Control(d);
                        }
                        catch (Exception ex)
                        {
@@ -991,8 +1006,6 @@
                };
                #endregion
            }