From 3f6685c77beeb12baf840733fb890860f4c26e7c Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期四, 25 七月 2024 17:25:59 +0800
Subject: [PATCH] 2024年07月25日17:24:45

---
 HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs |   86 +++++++++++++++++++++++++++++++++---------
 1 files changed, 67 insertions(+), 19 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs
index 107c8a3..a8048f1 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/GroupControlPage_V2.cs
@@ -97,9 +97,6 @@
             //    function.CollectFunction();
             //};
 
-
-           
-
             //鍥為��鍒锋柊淇℃伅浜嬩欢
             new TopViewDiv(bodyView, Language.StringByID(StringId.GroupControl)).LoadTopView_SettingIcon( () => {
                 var page = new AddGroupControlPage(function,
@@ -219,7 +216,7 @@
             var btnOnText = new Button()
             {
                 X = Application.GetRealWidth(100-9),
-                Y = Application.GetRealHeight(500),
+                Y = Application.GetRealHeight(495),
                 Width = Application.GetMinRealAverage(50),
                 Height = Application.GetMinRealAverage(32),
                 TextColor = CSS_Color.TextualColor,
@@ -242,7 +239,7 @@
             var btnOffText = new Button()
             {
                 X = Application.GetRealWidth(180 - 9),
-                Y = Application.GetRealHeight(500),
+                Y = Application.GetRealHeight(495),
                 Width = Application.GetMinRealAverage(50),
                 Height = Application.GetMinRealAverage(32),
                 TextColor = CSS_Color.TextualColor,
@@ -284,15 +281,15 @@
 
             if (hadRGB)
             {
-                LoadRgbAttrView(hadCCT,hadColorful);
+                LoadRgbAttrView(hadCCT,hadColorful,btnOn,btnOff);
             }
             else if (hadCCT)
             {
-                LoadCctAttrView(attrView);
+                LoadCctAttrView(attrView, btnOn, btnOff);
             }
             else if (hadDimming)
             {
-                LoadDimmingAttrView(attrView);
+                LoadDimmingAttrView(attrView, btnOn, btnOff);
             }
             else
             {
@@ -310,18 +307,26 @@
                 attrView.AddChidren(btnSwitchIcon);
 
                 btnSwitchIcon.MouseUpEventHandler = (sender, e) => {
+                    btnSwitchIcon.IsSelected = !btnSwitchIcon.IsSelected;
                     if (btnSwitchIcon.IsSelected)
-                    {
-                        var d = new Dictionary<string, string>();
-                        d.Add(FunctionAttributeKey.OnOff, "off");
-                        function.Control(d);
-                    }
-                    else
                     {
                         var d = new Dictionary<string, string>();
                         d.Add(FunctionAttributeKey.OnOff, "on");
                         function.Control(d);
                     }
+                    else
+                    {
+                        var d = new Dictionary<string, string>();
+                        d.Add(FunctionAttributeKey.OnOff, "off");
+                        function.Control(d);
+                    }
+                };
+
+                btnOn.MouseUpEventHandler += (sender, e) => {
+                    btnSwitchIcon.IsSelected = true;
+                };
+                btnOff.MouseUpEventHandler += (sender, e) => {
+                    btnSwitchIcon.IsSelected = false;
                 };
             }
 
@@ -334,7 +339,7 @@
         /// 鍔犺浇璋冨厜灞炴�ц缃帶浠�
         /// </summary>
         /// <param name="attrView"></param>
-        void LoadDimmingAttrView(VerticalScrolViewLayout attrView)
+        void LoadDimmingAttrView(VerticalScrolViewLayout attrView,Button btnOn,Button btnOff)
         {
 
 
@@ -388,6 +393,9 @@
 
             dimmerBar.OnProgressChangedEvent = (sender, e) =>
             {
+
+                btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100);
+                btnBrightnessText.Text = dimmerBar.Progress + "%";
                 return;
                 if (e == 0 && lastBrightness != 0)
                 {
@@ -420,10 +428,21 @@
                     }
                 }
 
+            };
 
+
+
+            btnOn.MouseUpEventHandler += (sender, e) => {
+                dimmerBar.Progress = 100;
                 btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100);
                 btnBrightnessText.Text = dimmerBar.Progress + "%";
             };
+            btnOff.MouseUpEventHandler += (sender, e) => {
+                dimmerBar.Progress = 0;
+                btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100);
+                btnBrightnessText.Text = dimmerBar.Progress + "%";
+            };
+
 
         }
         int lastBrightness = 0;
@@ -432,7 +451,7 @@
         /// 鍔犺浇cct灞炴�ц缃帶浠�
         /// </summary>
         /// <param name="attrView"></param>
-        void LoadCctAttrView(VerticalScrolViewLayout attrView)
+        void LoadCctAttrView(VerticalScrolViewLayout attrView,Button btnOn,Button btnOff)
         {
             attrView.AddChidren(new Button
             {
@@ -483,6 +502,8 @@
 
             dimmerBar.OnProgressChangedEvent = (sender, e) =>
             {
+                btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100);
+                btnBrightnessText.Text = dimmerBar.Progress + "%";
                 return;
                 if (e == 0 && lastBrightness != 0)
                 {
@@ -517,8 +538,6 @@
                 }
 
 
-                btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100);
-                btnBrightnessText.Text = dimmerBar.Progress + "%";
             };
 
       
@@ -616,13 +635,29 @@
             cctView.AddChidren(btnTempClolorMax);
 
             #endregion
+
+
+
+
+            btnOn.MouseUpEventHandler += (sender, e) => {
+                dimmerBar.Progress = 100;
+                btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100);
+                btnBrightnessText.Text = dimmerBar.Progress + "%";
+            };
+            btnOff.MouseUpEventHandler += (sender, e) => {
+                dimmerBar.Progress = 0;
+                btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100);
+                btnBrightnessText.Text = dimmerBar.Progress + "%";
+            };
+
+
         }
 
         /// <summary>
         /// 鍔犺浇rgb灞炴�ц缃帶浠�
         /// </summary>
         /// <param name="attrView"></param>
-        void LoadRgbAttrView(bool hadCCT,bool hadColorful)
+        void LoadRgbAttrView(bool hadCCT,bool hadColorful,Button btnOn,Button btnOff)
         {
             Light lightTemp = new Light();
             int magriHeight = 0;
@@ -805,6 +840,8 @@
 
             dimmerBar.OnProgressChangedEvent = (sender, e) =>
             {
+                //btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100);
+                //btnBrightnessText.Text = dimmerBar.Progress + "%";
                 return;
                 if (e == 0 && lastBrightness != 0)
                 {
@@ -1051,6 +1088,17 @@
                 #endregion
             }
 
+            btnOn.MouseUpEventHandler += (sender, e) => {
+                dimmerBar.Progress = 100;
+                //btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100);
+                //btnBrightnessText.Text = dimmerBar.Progress + "%";
+            };
+            btnOff.MouseUpEventHandler += (sender, e) => {
+                dimmerBar.Progress = 0;
+                //btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100);
+                //btnBrightnessText.Text = dimmerBar.Progress + "%";
+            };
+
 
 
         }

--
Gitblit v1.8.0