From 4f2dbd1f6a1ec2d9c3c39b4a37b0b7c9ddece4aa Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期四, 23 九月 2021 15:24:01 +0800
Subject: [PATCH] 主页刷新优化

---
 HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs |   33 ++++++++++++++++++++++-----------
 1 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs
index d480411..12a47a3 100644
--- a/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs
+++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs
@@ -49,6 +49,7 @@
                         case SPK.ElectricTuyaWaterValve:
                         case SPK.ElectricTuyaWeepRobot:
                         case SPK.ClothesHanger:
+                        case SPK.AirSwitch:
                             vv = ShowFunction.Electric;
                             break;
                         case SPK.AirFreshJinmao:
@@ -331,8 +332,12 @@
                 {
                     try
                     {
-                        //鍏ㄥ紑鍏ㄥ叧
-                        //if (DB_ResidenceData.Instance.GatewayType == 0 && !Control.Ins.IsRemote)
+                        //浼戠湢鏃堕棿(ms)
+                        int sleepTime = 100;
+                        if(DB_ResidenceData.Instance.GatewayType == 0)
+                        {
+                            sleepTime = 200;
+                        }
                         if (Control.Ins.GatewayOnline_Local)
                         {
                             switch (functionCategory)
@@ -344,7 +349,7 @@
                                         Dictionary<string, string> d = new Dictionary<string, string>();
                                         d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString());
                                         Control.Ins.SendWriteCommand(f, d);
-                                        System.Threading.Thread.Sleep(100);
+                                        System.Threading.Thread.Sleep(sleepTime);
                                     }
                                     break;
                                 case ShowFunction.FloorHeating:
@@ -354,7 +359,7 @@
                                         Dictionary<string, string> d = new Dictionary<string, string>();
                                         d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString());
                                         Control.Ins.SendWriteCommand(f, d);
-                                        System.Threading.Thread.Sleep(100);
+                                        System.Threading.Thread.Sleep(sleepTime);
                                     }
                                     break;
                                 case ShowFunction.Light:
@@ -364,7 +369,7 @@
                                         Dictionary<string, string> d = new Dictionary<string, string>();
                                         d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString());
                                         Control.Ins.SendWriteCommand(f, d);
-                                        System.Threading.Thread.Sleep(100);
+                                        System.Threading.Thread.Sleep(sleepTime);
                                     }
                                     break;
                                 case ShowFunction.Electric:
@@ -374,7 +379,7 @@
                                         Dictionary<string, string> d = new Dictionary<string, string>();
                                         d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString());
                                         Control.Ins.SendWriteCommand(f, d);
-                                        System.Threading.Thread.Sleep(100);
+                                        System.Threading.Thread.Sleep(sleepTime);
                                     }
                                     break;
                                 case ShowFunction.FreshAir:
@@ -384,7 +389,7 @@
                                         Dictionary<string, string> d = new Dictionary<string, string>();
                                         d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString());
                                         Control.Ins.SendWriteCommand(f, d);
-                                        System.Threading.Thread.Sleep(100);
+                                        System.Threading.Thread.Sleep(sleepTime);
                                     }
                                     break;
                             }
@@ -438,8 +443,11 @@
                     {
                         Application.RunOnMainThread(() =>
                         {
-                            waitPage.Hide();
-                            waitPage.RemoveFromParent();
+                            if (waitPage != null)
+                            {
+                                waitPage.RemoveFromParent();
+                                waitPage = null;
+                            }
                         });
                     }
                 })
@@ -484,8 +492,11 @@
                     {
                         Application.RunOnMainThread(() =>
                         {
-                            waitPage.Hide();
-                            waitPage.RemoveFromParent();
+                            if (waitPage != null)
+                            {
+                                waitPage.RemoveFromParent();
+                                waitPage = null;
+                            }
                         });
                     }
                 })

--
Gitblit v1.8.0