From 792ca2a402feb952ef890d653f2e049c1230baf1 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期六, 19 十二月 2020 18:48:33 +0800
Subject: [PATCH] 1111

---
 HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
old mode 100644
new mode 100755
index ea6db63..39ecc10
--- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
@@ -217,9 +217,26 @@
                 new System.Threading.Thread(() =>
                 {
                     function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
-                    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
-                    d.Add("on_off", function.trait_on_off.curValue.ToString());
-                    Control.Ins.SendWriteCommand(function, d);
+                    Dictionary<string, string> d = new Dictionary<string, string>();
+                    if (function.spk == SPK.LightDimming || function.spk == SPK.LightRGB)
+                    {
+                        var light = function as Light;
+                        d.Add(FunctionAttributeKey.OnOff, light.trait_on_off.curValue.ToString());
+                        if (btnSwitch.IsSelected)
+                        {
+                            d.Add(FunctionAttributeKey.Brightness, light.lastBrightness.ToString());
+                        }
+                        else
+                        {
+                            light.lastBrightness = light.brightness;
+                        }
+                        Control.Ins.SendWriteCommand(light, d);
+                    }
+                    else
+                    {
+                        d.Add("on_off", function.trait_on_off.curValue.ToString());
+                        Control.Ins.SendWriteCommand(function, d);
+                    }
                 })
                 { IsBackground = true }.Start();
             };
@@ -348,11 +365,8 @@
                                 {
                                     ShowMesBtnState(pushMessageInfoList[0], true);
                                 });
-                               
                             }
-
                         }
-
                     }
                     else
                     {
@@ -366,9 +380,7 @@
                 {
                     isGetting = false;
                 }
-
             });
-
         }
 
         /// <summary>

--
Gitblit v1.8.0