From a7debf97f52b5f473c3316ecd06bf48f44b65406 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 09 八月 2023 18:03:04 +0800
Subject: [PATCH] 温度类型,炫彩起始颜色

---
 HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs |   47 ++++++++++++++++++++++++++++++++---------------
 1 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs
index 3b9270e..f51e8a3 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs
+++ b/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
@@ -774,6 +776,22 @@
                             function.Control(d);
                         })
                         { IsBackground = true }.Start();
+                    }
+                }
+                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";
                     }
                 }
             };
@@ -796,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
@@ -891,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";
@@ -902,9 +924,7 @@
 
                 #endregion
 
-
                 heightMore = 70;
-
             }
 
             if (hadColorful)
@@ -975,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)
                         {
@@ -987,8 +1006,6 @@
                 };
 
                 #endregion
-
-
             }
 
 

--
Gitblit v1.8.0