From 762eed3a31840aa91ac508c63b8df54029cf0262 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 18 七月 2023 16:48:12 +0800
Subject: [PATCH] 炫彩功能优化

---
 HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs |   32 ++++++++++++++++++++++++++------
 1 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
index 9f5c0ef..670beb1 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
@@ -1910,6 +1910,7 @@
                 {
                     isColorful = true;
                     LoadColorfulRow(colorfulStatus);
+                    isColorful = colorfulStatus.value == "on";
                 }
             }
             foreach (var attr in sceneFunction.status)
@@ -1983,7 +1984,20 @@
             {
                 if (isOnStatus)
                 {
-
+                    if (isColorful)
+                    {
+                        sceneFunction.status.Clear();
+                        sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.OnOff, value = "on" });
+                        sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.Colorful, value = "on" });
+                    }
+                    else
+                    {
+                        var isHasColorful = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful);
+                        if (isHasColorful != null)
+                        {
+                            sceneFunction.status.Remove(isHasColorful);
+                        }
+                    }
                 }
                 else
                 {
@@ -2030,6 +2044,9 @@
                     this.RemoveFromParent();
                 }
             };
+
+
+            UpdataFunctionRow();
         }
 
         void UpdataFunctionRow()
@@ -2544,11 +2561,13 @@
 
             dialog.Show();
 
-            pView.MouseUpEventHandler = (sender, e) => {
+            pView.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
             };
 
-            btnCancel.MouseUpEventHandler = (sender, e) => {
+            btnCancel.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
             };
             btnOn.MouseUpEventHandler = (sender, e) =>
@@ -2609,10 +2628,10 @@
                     MainPage.Log($"鍦烘櫙閰嶇疆寮傚父3锛歿ex.Message}");
                 }
             };
-            btnOff.MouseUpEventHandler = (sender,e) =>{
+            btnOff.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
                 trait.value = "off";
-                isOnStatus = false;
                 try
                 {
                     sceneFunction.status.Find((obj) => obj.key == trait.key).value = "off";
@@ -2627,6 +2646,7 @@
                     btn.Text = trait.GetValueText() + trait.GetUintString();
                     if (trait.key == FunctionAttributeKey.OnOff)
                     {
+                        isOnStatus = false;
                         var temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness);
                         if (temp == null)
                         {
@@ -2664,7 +2684,7 @@
                 {
                     MainPage.Log($"鍦烘櫙閰嶇疆寮傚父3锛歿ex.Message}");
                 }
-        };
+            };
 
         }
 

--
Gitblit v1.8.0