From 86db3175d109ab7d5abfb65058228a496f2492ec Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期一, 07 十二月 2020 11:31:41 +0800
Subject: [PATCH] 20201207

---
 HDL_ON/Entity/FunctionList.cs |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs
index a48047a..a7ef6e8 100644
--- a/HDL_ON/Entity/FunctionList.cs
+++ b/HDL_ON/Entity/FunctionList.cs
@@ -1,6 +1,7 @@
 锘縰sing System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Threading;
 using HDL_ON.DAL;
 using HDL_ON.DAL.Server;
 
@@ -503,6 +504,53 @@
             FileUtils.DeleteFile(delTemp.savePath);
         }
 
+        /// <summary>
+        /// 璇诲彇鍏ㄩ儴鍔熻兘鐨勭姸鎬�
+        /// </summary>
+        public void ReadAllFunctionStatus()
+        {
+            new Thread(() =>
+            {
+                try
+                {
+                    if (DB_ResidenceData.residenceData.GatewayType == 0)
+                    {
+                        foreach (var function in GetAllDeviceFunctionList())
+                        {
+                            switch (function.functionCategory)
+                            {
+                                case FunctionCategory.Light:
+                                case FunctionCategory.Electrical:
+                                case FunctionCategory.SwitchDevice:
+                                case FunctionCategory.Curtain:
+                                case FunctionCategory.Thermostat:
+                                    DriverLayer.Control.Ins.SendReadCommand(function);
+                                    break;
+                            }
+                        }
+                    }
+                    else
+                    {
+                        List<Dictionary<string, string>> keyValuePairs = new List<Dictionary<string, string>>();
+                        foreach (var function in GetAllDeviceFunctionList())
+                        {
+                            var kv = new Dictionary<string, string>();
+                            kv.Add("sid", function.sid);
+                            keyValuePairs.Add(kv);
+                        }
+                        DriverLayer.Control.Ins.SendReadCommand(keyValuePairs);
+                    }
+                }
+                catch (Exception ex)
+                {
+                    MainPage.Log($"Refresh Residence Function Status Error : {ex.Message}");
+                }
+            })
+            { IsBackground = true }.Start();
+
+
+        }
+
     }
 
 }

--
Gitblit v1.8.0