From 42368161d6b795058dfc99ee9774aaf3f69e81d4 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 07 七月 2021 15:24:19 +0800
Subject: [PATCH] 2021-07-07 15:11:03

---
 HDL_ON/DAL/DriverLayer/Control.cs |   43 ++++++++++++++++++++++++++++---------------
 1 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index 913c52a..0152ec7 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -467,28 +467,41 @@
             }
 
             var count = 0;
-            var logString = open ? "鎵撳紑\r\n" : "鍏抽棴\r\n";
             List<ApiAlinkControlActionObj> actionObjs = new List<ApiAlinkControlActionObj>();
             Dictionary<string, string> d = new Dictionary<string, string>();
             d.Add(FunctionAttributeKey.OnOff, open ? "on" : "off");
             var pm = new DAL.Server.HttpServerRequest();
-            foreach (var temp in functions)
+            //涓�绔彛鍏ㄥ紑鍏ㄥ叧闇�瑕佸欢鏃跺彂閫�
+            if (DB_ResidenceData.Instance.GatewayType == 0)
             {
-                logString += temp.spk + ":" + temp.sid + "\r\n";
-                var apiControlData = temp.GetApiControlData(d);
-                actionObjs.Add(apiControlData);
-                count++;
-                if (count > 9)
+                new System.Threading.Thread(() =>
                 {
-                    var result = pm.ControlDevice(actionObjs);
-                    actionObjs = new List<ApiAlinkControlActionObj>();
-                    count = 0;
-                    MainPage.Log(logString);
-                    logString = "";
-                }
+                    foreach (var temp in functions)
+                    {
+                        var apiControlData = temp.GetApiControlData(d);
+                        var result = pm.ControlDevice(new List<ApiAlinkControlActionObj>() { apiControlData });
+                        System.Threading.Thread.Sleep(100);
+                    }
+                })
+                { IsBackground = true }.Start();
             }
-            var pack = pm.ControlDevice(actionObjs);
-            MainPage.Log(logString);
+            else
+            {
+                foreach (var temp in functions)
+                {
+                    var apiControlData = temp.GetApiControlData(d);
+                    actionObjs.Add(apiControlData);
+                    count++;
+                    if (count > 9)
+                    {
+                        var result = pm.ControlDevice(actionObjs);
+                        actionObjs = new List<ApiAlinkControlActionObj>();
+                        count = 0;
+                        System.Threading.Thread.Sleep(100);
+                    }
+                }
+                var pack = pm.ControlDevice(actionObjs);
+            }
         }
 
         public void SendApiReadCommand(List<string> functionIds)

--
Gitblit v1.8.0