| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Threading; |
| | | using HDL_ON.DAL; |
| | | using HDL_ON.DAL.Server; |
| | | |
| | |
| | | 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(); |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |