From 4b6653dbbc167439b94541613681c062fed2f087 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期六, 19 十二月 2020 18:33:47 +0800
Subject: [PATCH] 20201219-3

---
 HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs |   44 ++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
old mode 100755
new mode 100644
index 3131df6..e77d419
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
@@ -11,6 +11,7 @@
         FrameLayout bodyView;
         VerticalScrolViewLayout contentView;
         Button btnOnText;
+        Button btnBrightnessText;
 
         Scene scene;
 
@@ -122,6 +123,15 @@
             btnConfrim.MouseUpEventHandler = (sender, e) =>
             {
                 var temp = scene.functions.Find((obj) => obj.sid == sceneFunction.sid);
+                if (sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness) != null)
+                {
+                    try
+                    {
+                        //涓�绔彛涓嶆敮鎸佸紑鍏冲�间笌浜害鍊间竴璧峰鐞嗭紝闇�瑕佸皢寮�鍏冲�肩Щ闄ゆ帀
+                        sceneFunction.status.Remove(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff));
+                    }
+                    catch { }
+                }
                 if (temp != null)
                 {
                     temp = sceneFunction;
@@ -136,7 +146,7 @@
                     if (result == DAL.Server.StateCode.SUCCESS)
                     {
                         refreshAction();
-                    this.RemoveFromParent();
+                        this.RemoveFromParent();
                     }
                     else
                     {
@@ -145,7 +155,7 @@
                 }
                 else
                 {
-                        refreshAction();
+                    refreshAction();
                     this.RemoveFromParent();
                 }
             };
@@ -170,7 +180,7 @@
             {
                 row.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor });
             }
-            Button btnBrightnessRight = new Button()
+            Button btnRight = new Button()
             {
                 X = Application.GetRealWidth(339),
                 Gravity = Gravity.CenterVertical,
@@ -178,7 +188,7 @@
                 Height = Application.GetMinRealAverage(16),
                 UnSelectedImagePath = "Public/Right.png",
             };
-            row.AddChidren(btnBrightnessRight);
+            row.AddChidren(btnRight);
 
             var btnFunctionText = new Button()
             {
@@ -190,7 +200,13 @@
             };
             row.AddChidren(btnFunctionText);
             if (sceneStatus.key == FunctionAttributeKey.OnOff)
+            {
                 btnOnText = btnFunctionText;
+            }
+            else if (sceneStatus.key == FunctionAttributeKey.Brightness)
+            {
+                btnBrightnessText = btnFunctionText;
+            }
 
             var btnFunctionName = new Button()
             {
@@ -395,12 +411,32 @@
                 trait.value = "on";
                 sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = "on";
                 btn.Text = FunctionList.List.GetValueText(trait.key, trait.value) + FunctionList.List.GetUintString(trait.key);
+
+                var temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness);
+                if (temp != null)
+                {
+                    if (temp.value == "0")
+                    {
+                        temp.value = "100";
+                    }
+                    btnBrightnessText.Text = FunctionList.List.GetValueText(temp.key, temp.value);
+                }
             };
             btnOff.MouseUpEventHandler = (sender,e) =>{
                 dialog.Close();
                 trait.value = "off";
                 sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = "off";
                 btn.Text= FunctionList.List.GetValueText(trait.key,trait.value) + FunctionList.List.GetUintString(trait.key);
+
+                var temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness);
+                if (temp != null)
+                {
+                    if (temp.value != "0")
+                    {
+                        temp.value = "0";
+                    }
+                    btnBrightnessText.Text = FunctionList.List.GetValueText(temp.key, temp.value);
+                }
             };
 
         }

--
Gitblit v1.8.0