From 6d73bf6e816570291865674bef8bce8972e4de3f Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期三, 01 十二月 2021 16:32:57 +0800
Subject: [PATCH] 2021-12-01-01

---
 HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs |   85 +++++++++++++++++++++---------------------
 1 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs
index d480411..0e8f778 100644
--- a/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs
+++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs
@@ -23,38 +23,29 @@
                 try
                 {
                     ShowFunction vv = ShowFunction.Light;
-                    switch (function.spk)
+                    if (SPK.ElectricalSpkList().Contains(function.spk))
                     {
-                        case SPK.FloorHeatStandard:
-                            vv = ShowFunction.FloorHeating;
-                            break;
-                        case SPK.AcStandard:
-                            vv = ShowFunction.AC;
-                            break;
-                        case SPK.CurtainRoller:
-                        case SPK.CurtainShades:
-                        case SPK.CurtainSwitch:
-                        case SPK.CurtainTrietex:
-                            vv = ShowFunction.Curtain;
-                            break;
-                        case SPK.LightCCT:
-                        case SPK.LightDimming:
-                        case SPK.LightRGB:
-                        case SPK.LightSwitch:
-                            vv = ShowFunction.Light;
-                            break;
-                        case SPK.ElectricSocket:
-                        case SPK.ElectricTuyaAirCleaner:
-                        case SPK.ElectricTuyaFan:
-                        case SPK.ElectricTuyaWaterValve:
-                        case SPK.ElectricTuyaWeepRobot:
-                        case SPK.ClothesHanger:
-                            vv = ShowFunction.Electric;
-                            break;
-                        case SPK.AirFreshJinmao:
-                        case SPK.AirFreshStandard:
-                            vv = ShowFunction.FreshAir;
-                            break;
+                        vv = ShowFunction.Electric;
+                    }
+                    else if (SPK.FhSpkList().Contains(function.spk))
+                    {
+                        vv = ShowFunction.FloorHeating;
+                    }
+                    else if (SPK.AcSpkList().Contains(function.spk))
+                    {
+                        vv = ShowFunction.AC;
+                    }
+                    else if (SPK.CurtainSpkList().Contains(function.spk))
+                    {
+                        vv = ShowFunction.Curtain;
+                    }
+                    else if (SPK.LightSpkList().Contains(function.spk))
+                    {
+                        vv = ShowFunction.Light;
+                    }
+                    else if (SPK.AirFreshSpkList().Contains(function.spk))
+                    {
+                        vv = ShowFunction.FreshAir;
                     }
                     UpdataFunctionOnCount(vv, function.spk);
                     UpdataCloseAllButton(function);
@@ -331,8 +322,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 +339,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 +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.Light:
@@ -364,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.Electric:
@@ -374,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.FreshAir:
@@ -384,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;
                             }
@@ -438,8 +433,11 @@
                     {
                         Application.RunOnMainThread(() =>
                         {
-                            waitPage.Hide();
-                            waitPage.RemoveFromParent();
+                            if (waitPage != null)
+                            {
+                                waitPage.RemoveFromParent();
+                                waitPage = null;
+                            }
                         });
                     }
                 })
@@ -484,8 +482,11 @@
                     {
                         Application.RunOnMainThread(() =>
                         {
-                            waitPage.Hide();
-                            waitPage.RemoveFromParent();
+                            if (waitPage != null)
+                            {
+                                waitPage.RemoveFromParent();
+                                waitPage = null;
+                            }
                         });
                     }
                 })

--
Gitblit v1.8.0