From 068c68295cad1967f7aafb4e5e951260ef03d4ce Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期五, 09 七月 2021 09:16:43 +0800
Subject: [PATCH] 状态属性更改,不要轻易合并

---
 HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs |   68 ++++++++++++++++++----------------
 1 files changed, 36 insertions(+), 32 deletions(-)

diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs
index d480411..46b6233 100644
--- a/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs
+++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs
@@ -108,22 +108,22 @@
                                                     switch (functionCategory)
                                                     {
                                                         case ShowFunction.FloorHeating:
-                                                            btnText = FunctionList.List.GetFloorHeatingList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString();
+                                                            btnText = FunctionList.List.GetFloorHeatingList().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count.ToString();
                                                             break;
                                                         case ShowFunction.AC:
-                                                            btnText = FunctionList.List.GetAcList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString();
+                                                            btnText = FunctionList.List.GetAcList().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count.ToString();
                                                             break;
                                                         case ShowFunction.Curtain:
-                                                            btnText = FunctionList.List.GetCurtainList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString();
+                                                            btnText = FunctionList.List.GetCurtainList().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count.ToString();
                                                             break;
                                                         case ShowFunction.Light:
-                                                            btnText = FunctionList.List.GetLightList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString();
+                                                            btnText = FunctionList.List.GetLightList().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count.ToString();
                                                             break;
                                                         case ShowFunction.Electric:
-                                                            btnText = FunctionList.List.GetElectricals().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString();
+                                                            btnText = FunctionList.List.GetElectricals().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count.ToString();
                                                             break;
                                                         case ShowFunction.FreshAir:
-                                                            btnText = FunctionList.List.GetAirFreshList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString();
+                                                            btnText = FunctionList.List.GetAirFreshList().FindAll((obj) => obj.trait_on_off.state.ToString() == "on").Count.ToString();
                                                             break;
                                                     }
                                                     if (btn.Tag.ToString() == functionCategory + "_onCount")
@@ -168,7 +168,7 @@
                             var btn = view1.GetChildren(j) as Button;
                             if (btn.Tag != null && btn.Tag.ToString() == "AllClose")
                             {
-                                if (function.trait_on_off.curValue.ToString() == "on")
+                                if (function.trait_on_off.state.ToString() == "on")
                                 {
                                     btn.Visible = true;
                                 }
@@ -185,7 +185,7 @@
                                         {
                                             continue;
                                         }
-                                        var ssd = r.GetRoomFunctions(false).FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on");
+                                        var ssd = r.GetRoomFunctions(false).FindAll((obj) => obj.trait_on_off.state.ToString() == "on");
                                         var sss = ssd.Count;
                                         if (sss == 0)
                                         {
@@ -215,9 +215,9 @@
                         {
                             foreach (var f in room.GetRoomFunctions(false))
                             {
-                                f.trait_on_off.curValue = "off";
+                                f.trait_on_off.state = "off";
                                 Dictionary<string, string> d = new Dictionary<string, string>();
-                                d.Add("on_off", f.trait_on_off.curValue.ToString());
+                                d.Add("on_off", f.trait_on_off.state.ToString());
                                 Control.Ins.SendWriteCommand(f, d);
                             }
 
@@ -237,7 +237,7 @@
                 };
                 foreach (var f in room.GetRoomFunctions(false))
                 {
-                    if (f.trait_on_off.curValue.ToString() == "on")
+                    if (f.trait_on_off.state.ToString() == "on")
                     {
                         btn.Visible = true;
                         break;
@@ -331,8 +331,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)
@@ -340,51 +344,51 @@
                                 case ShowFunction.AC:
                                     foreach (var f in FunctionList.List.GetAcList())
                                     {
-                                        f.trait_on_off.curValue = onoff;
+                                        f.trait_on_off.state = onoff;
                                         Dictionary<string, string> d = new Dictionary<string, string>();
-                                        d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString());
+                                        d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.state.ToString());
                                         Control.Ins.SendWriteCommand(f, d);
-                                        System.Threading.Thread.Sleep(100);
+                                        System.Threading.Thread.Sleep(sleepTime);
                                     }
                                     break;
                                 case ShowFunction.FloorHeating:
                                     foreach (var f in FunctionList.List.GetFloorHeatingList())
                                     {
-                                        f.trait_on_off.curValue = onoff;
+                                        f.trait_on_off.state = onoff;
                                         Dictionary<string, string> d = new Dictionary<string, string>();
-                                        d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString());
+                                        d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.state.ToString());
                                         Control.Ins.SendWriteCommand(f, d);
-                                        System.Threading.Thread.Sleep(100);
+                                        System.Threading.Thread.Sleep(sleepTime);
                                     }
                                     break;
                                 case ShowFunction.Light:
                                     foreach (var f in FunctionList.List.GetLightList())
                                     {
-                                        f.trait_on_off.curValue = onoff;
+                                        f.trait_on_off.state = onoff;
                                         Dictionary<string, string> d = new Dictionary<string, string>();
-                                        d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString());
+                                        d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.state.ToString());
                                         Control.Ins.SendWriteCommand(f, d);
-                                        System.Threading.Thread.Sleep(100);
+                                        System.Threading.Thread.Sleep(sleepTime);
                                     }
                                     break;
                                 case ShowFunction.Electric:
                                     foreach (var f in FunctionList.List.GetElectricals())
                                     {
-                                        f.trait_on_off.curValue = onoff;
+                                        f.trait_on_off.state = onoff;
                                         Dictionary<string, string> d = new Dictionary<string, string>();
-                                        d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString());
+                                        d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.state.ToString());
                                         Control.Ins.SendWriteCommand(f, d);
-                                        System.Threading.Thread.Sleep(100);
+                                        System.Threading.Thread.Sleep(sleepTime);
                                     }
                                     break;
                                 case ShowFunction.FreshAir:
                                     foreach (var f in FunctionList.List.GetAirFreshList())
                                     {
-                                        f.trait_on_off.curValue = onoff;
+                                        f.trait_on_off.state = onoff;
                                         Dictionary<string, string> d = new Dictionary<string, string>();
-                                        d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString());
+                                        d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.state.ToString());
                                         Control.Ins.SendWriteCommand(f, d);
-                                        System.Threading.Thread.Sleep(100);
+                                        System.Threading.Thread.Sleep(sleepTime);
                                     }
                                     break;
                             }
@@ -468,10 +472,10 @@
                     {
                         foreach (var f in FunctionList.List.GetCurtainList())
                         {
-                            f.trait_on_off.curValue = "on";
+                            f.trait_on_off.state = "on";
                             f.SetAttrState(FunctionAttributeKey.Percent, "100");
                             Dictionary<string, string> d = new Dictionary<string, string>();
-                            d.Add("on_off", f.trait_on_off.curValue.ToString());
+                            d.Add("on_off", f.trait_on_off.state.ToString());
                             Control.Ins.SendWriteCommand(f, d);
                             System.Threading.Thread.Sleep(100);
                         }
@@ -499,10 +503,10 @@
                 btnOpen.IsSelected = false;
                 foreach (var f in FunctionList.List.GetCurtainList())
                 {
-                    f.trait_on_off.curValue = "off";
+                    f.trait_on_off.state = "off";
                     f.SetAttrState(FunctionAttributeKey.Percent, "0");
                     Dictionary<string, string> d = new Dictionary<string, string>();
-                    d.Add("on_off", f.trait_on_off.curValue.ToString());
+                    d.Add("on_off", f.trait_on_off.state.ToString());
                     Control.Ins.SendWriteCommand(f, d);
                 }
             };

--
Gitblit v1.8.0