From c5a873df96e4a797426e4dd5eafe5b43f7aea564 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期六, 19 十二月 2020 15:41:53 +0800
Subject: [PATCH] 20201218-2

---
 HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs |   56 ++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 46 insertions(+), 10 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 27e7a31..39ecc10
--- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
@@ -81,7 +81,7 @@
                 scene.collect = false;
                 string msg = scene.name + Language.StringByID(StringId.CollectionCancelled);
                 LoadSceneFunctionControlZone();
-                scene.SaveSceneData(true);
+                scene.CollectScene();
                 new PublicAssmebly().TipMsgAutoClose(msg, true);
             };
         }
@@ -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();
             };
@@ -282,6 +299,7 @@
 
                 //鎴块棿鍒犻櫎浜嬩欢
                 Action backAction = () => {
+                    RegisterGetPushMessageAction();
                     GetUnreadPushMessages();
                 };
 
@@ -347,11 +365,8 @@
                                 {
                                     ShowMesBtnState(pushMessageInfoList[0], true);
                                 });
-                               
                             }
-
                         }
-
                     }
                     else
                     {
@@ -365,9 +380,7 @@
                 {
                     isGetting = false;
                 }
-
             });
-
         }
 
         /// <summary>
@@ -403,7 +416,7 @@
         {
             try
             {
-                return Utlis.UnixToDateTimeWithFormatMS(time, "HH:mm");
+                return Utlis.ToFriendlyDisplay(time);
             }
             catch (Exception ex)
             {
@@ -411,6 +424,29 @@
             }
         }
 
+        /// <summary>
+        /// 娉ㄥ唽鏀跺埌鎺ㄩ�佺洃鍚�
+        /// </summary>
+        void RegisterGetPushMessageAction()
+        {
+            Action RegisterGetPushMessageAction = () => {
+                if (bodyView != null)
+                {
+                    //Utlis.WriteLine("GetPushMessageAction H鏀跺埌鎺ㄩ��");
+                    GetUnreadPushMessages();
+                }
+            };
+            HDLCommon.GetPushMessageAction = RegisterGetPushMessageAction;
+        }
+
+        /// <summary>
+        /// 鍙栨秷鏀跺埌鎺ㄩ�佺洃鍚�
+        /// </summary>
+        void UnregisterGetPushMessageAction()
+        {
+            HDLCommon.GetPushMessageAction = null;
+        }
+
         #endregion
 
     }

--
Gitblit v1.8.0