From e0cea373fd5cda37421407a41453286469ac1145 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 05 七月 2021 11:16:11 +0800
Subject: [PATCH] Merge branch 'WJC' into MergeFL

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs |   72 ++++++++++++++++++++++++------------
 1 files changed, 48 insertions(+), 24 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index d40c649..da993e1 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -8,6 +8,22 @@
 
     public class LogicMethod
     {
+
+        private static LogicMethod logicMethod = null;
+
+        public static LogicMethod CurrLogicMethod
+        {
+            get
+            {
+                if (logicMethod == null)
+                {
+                    return new LogicMethod();
+                }
+                return logicMethod;
+            }
+
+        }
+
         /// <summary>
         /// 琛ㄧず鏄潯浠�
         /// </summary>
@@ -19,15 +35,15 @@
         /// <summary>
         /// 绉婚櫎鎵�鏈�"Logic"鐣岄潰
         /// </summary>
-        public static void RemoveAllView()
+        public void RemoveAllView()
         {
             MainPage.BasePageView.RemoveViewByTag("Logic");
         }
-       
+
         /// <summary> Converts an array of bytes into a formatted string of hex digits (ex: E4 CA B2)</summary>
         /// <param name="data"> The array of bytes to be translated into a string of hex digits. </param>
         /// <returns> Returns a well formatted string of hex digits with spacing. </returns>
-        static string byteArrayToHexString(byte[] data)
+        public string byteArrayToHexString(byte[] data)
         {
             System.Text.StringBuilder sb = new System.Text.StringBuilder();
             foreach (byte b in data)
@@ -46,7 +62,7 @@
   * @param i 涓�涓猧nt鏁板瓧
   * @return byte[]
   */
-        public static byte[] int2ByteArray(int i)
+        public byte[] int2ByteArray(int i)
         {
             byte[] result = new byte[4];
             result[0] = (byte)((i >> 24) & 0xFF);
@@ -59,7 +75,7 @@
         /// 鑾峰彇鏃堕棿鎴�
         /// </summary>
         /// <returns></returns>
-        static int getTimeStamp()
+        public int getTimeStamp()
         {
             TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
             return (int)ts.TotalSeconds;
@@ -67,7 +83,7 @@
         /// <summary>
         /// 鐢熸垚閫昏緫sid鏂规硶
         /// </summary>
-        public static string NewSid()
+        public string NewSid()
         {
             string logicId = "";
             try
@@ -111,7 +127,7 @@
         /// <param name="dic">Dictionary绫�</param>
         /// <param name="key">鍋�</param>
         /// <param name="value">鍊�</param>
-        public static void dictionary(Dictionary<string, string> dic, string key, string value)
+        public void dictionary(Dictionary<string, string> dic, string key, string value)
         {
             if (dic.ContainsKey(key)) //鍒ゆ柇鏄惁瀛樺湪閿��
             {
@@ -125,7 +141,7 @@
         /// 鑾峰彇缃戝叧鎴块棿鍒楄〃
         /// </summary>
         /// <returns></returns>
-        public static List<HDL_ON.Entity.Room> GetGatewayRoomList()
+        public List<HDL_ON.Entity.Room> GetGatewayRoomList()
         {
             return HDL_ON.Entity.SpatialInfo.CurrentSpatial.RoomList;
         }
@@ -133,7 +149,7 @@
         /// 鑾峰彇缃戝叧鎴块棿鍒楄〃
         /// </summary>
         /// <returns></returns>
-        public static List<HDL_ON.Entity.Room> GetGatewayRoomList(string name)
+        public List<HDL_ON.Entity.Room> GetGatewayRoomList(string name)
         {
             List<Entity.Room> roomList = new List<Entity.Room>();
             Entity.Room room1 = new Entity.Room();
@@ -158,7 +174,7 @@
         /// 鑾峰彇缃戝叧璁惧鍒楄〃
         /// </summary>
         /// <returns></returns>
-        public static List<HDL_ON.Entity.Function> GetGatewayDeviceList()
+        public List<HDL_ON.Entity.Function> GetGatewayDeviceList()
         {
             return Entity.FunctionList.List.GetDeviceFunctionList();
         }
@@ -166,7 +182,7 @@
         /// 鑾峰彇缃戝叧鍦烘櫙鍒楄〃
         /// </summary>
         /// <returns></returns>
-        public static List<HDL_ON.Entity.Scene> GetSceneList()
+        public List<HDL_ON.Entity.Scene> GetSceneList()
         {
             return HDL_ON.Entity.FunctionList.List.scenes;
         }
@@ -175,7 +191,7 @@
         /// </summary>
         /// <param name="room">褰撳墠鎴块棿</param>
         /// <returns></returns>
-        public static List<HDL_ON.Entity.Function> GetRoomDevice(HDL_ON.Entity.Room room)
+        public List<HDL_ON.Entity.Function> GetRoomDevice(HDL_ON.Entity.Room room)
         {
             List<HDL_ON.Entity.Function> deviceLists = new List<Entity.Function>();
             List<HDL_ON.Entity.Function> lists = GetGatewayDeviceList();
@@ -205,7 +221,7 @@
         /// </summary>
         /// <param name="sid">璁惧鍞竴鏍囪瘑</param>
         /// <returns></returns>
-        public static HDL_ON.Entity.Function GetDevice(string sid)
+        public HDL_ON.Entity.Function GetDevice(string sid)
         {
             HDL_ON.Entity.Function device = new Entity.Function() { name = "Unknown" };
             List<HDL_ON.Entity.Function> deviceLists = GetGatewayDeviceList();
@@ -226,7 +242,7 @@
         /// </summary>
         /// <param name="sid">鍦烘櫙鍞竴鏍囪瘑</param>
         /// <returns></returns>
-        public static HDL_ON.Entity.Scene GetSecne(string sid)
+        public HDL_ON.Entity.Scene GetSecne(string sid)
         {
             HDL_ON.Entity.Scene scene = new Entity.Scene() { name = "Unknown" };
             List<HDL_ON.Entity.Scene> sceneLists = GetSceneList();
@@ -246,7 +262,7 @@
         /// </summary>
         /// <param name="device">璁惧</param>
         /// <returns></returns>
-        public static string GetGetRoomName(HDL_ON.Entity.Function device)
+        public string GetGetRoomName(HDL_ON.Entity.Function device)
         {
             string roomName = "";
             List<HDL_ON.Entity.Room> roomLists = GetGatewayRoomList();
@@ -268,7 +284,7 @@
         /// </summary>
         /// <param name="functionType">璁惧绫诲瀷</param>
         /// <returns></returns>
-        public static string GetIconPath(string functionType)
+        public string GetIconPath(string functionType)
         {
             string strPath = "";
             switch (functionType)
@@ -309,6 +325,7 @@
                 case SPK.SensorDoorWindow:
                 case SPK.SensoruUtrasonic:
                 case SPK.SenesorMegahealth:
+                case SPK.SenesorEnvironment:
                     {
                         strPath = "LogicIcon/sensor.png";
                     }
@@ -322,7 +339,7 @@
         /// </summary>
         /// <param name="deviceList">璁惧鍒楄〃</param>
         /// <returns></returns>
-        public static List<string> GetDeviceTypeList(List<HDL_ON.Entity.Function> deviceList)
+        public List<string> GetDeviceTypeList(List<HDL_ON.Entity.Function> deviceList)
         {
             List<string> deviceStrTypeList = new List<string>();
             deviceStrTypeList.Clear();
@@ -367,6 +384,7 @@
             || device.spk == SPK.SensorDoorWindow
             || device.spk == SPK.SensoruUtrasonic
             || device.spk == SPK.SenesorMegahealth
+            || device.spk == SPK.SenesorEnvironment
             );
             if (sensor != null)
             {
@@ -380,7 +398,7 @@
         /// </summary>
         /// <param name="deviceType">璁惧绫诲瀷(鐏厜绫伙紝绐楀笜绫汇��)</param>
         /// <returns></returns>
-        public static List<string> GetDeviceTypeFunctionList(string deviceType)
+        public List<string> GetDeviceTypeFunctionList(string deviceType)
         {
             List<string> functionTypeList = new List<string>();
             if (deviceType == Language.StringByID(StringId.Lights))
@@ -417,6 +435,8 @@
                 functionTypeList.Add(SPK.SensorDoorWindow);
                 functionTypeList.Add(SPK.SensoruUtrasonic);
                 functionTypeList.Add(SPK.SenesorMegahealth);
+                functionTypeList.Add(SPK.SenesorEnvironment);
+
 
             }
             return functionTypeList;
@@ -426,7 +446,7 @@
         /// 鏉′欢/鐩爣鏀寔璁惧
         /// </summary>
         /// <returns></returns>
-        public static List<string> GetSupportEquipment(string if_type)
+        public List<string> GetSupportEquipment(string if_type)
         {
             List<string> deviceTypeList = new List<string>();
             switch (if_type)
@@ -453,6 +473,8 @@
                         deviceTypeList.Add(SPK.SensorDoorWindow);
                         deviceTypeList.Add(SPK.SensoruUtrasonic);
                         deviceTypeList.Add(SPK.SenesorMegahealth);
+                        deviceTypeList.Add(SPK.SenesorEnvironment);
+
                     }
                     break;
                 case target_if:
@@ -479,7 +501,7 @@
         /// <param name="functionType">婧愭暟鎹垪琛�1</param>
         /// <param name="deviceList">婧愭暟鎹垪琛�2</param>
         /// <returns></returns>
-        public static List<Entity.Function> GetShowDeviceList(List<string> functionType, List<HDL_ON.Entity.Function> deviceList)
+        public List<Entity.Function> GetShowDeviceList(List<string> functionType, List<HDL_ON.Entity.Function> deviceList)
         {
             List<HDL_ON.Entity.Function> devList = new List<Entity.Function>();
             for (int i = 0; i < deviceList.Count; i++)
@@ -501,7 +523,7 @@
         /// <param name="room">褰撳墠鎴块棿</param>
         /// <param name="str">鍒ゆ柇绗︼紙琛ㄧず=杈撳叆璁惧鍜岃緭鍑鸿澶囷級</param>
         /// <returns></returns>
-        public static List<Entity.Function> GetFunctionDeviceList(Entity.Room room, string str)
+        public List<Entity.Function> GetFunctionDeviceList(Entity.Room room, string str)
         {
             List<string> functionTypeList = GetSupportEquipment(str);
             //杩斿洖鎴块棿璁惧鍒楄〃
@@ -513,7 +535,7 @@
         /// <summary>
         /// 缃戝叧ID(鑾峰彇鍢変箰缃戝叧ID)
         /// </summary>
-        public static string GatewayId
+        public string GatewayId
         {
             get
             {
@@ -527,7 +549,7 @@
         /// <summary>
         /// 浣忓畢ID
         /// </summary>
-        public static string HomeId
+        public string HomeId
         {
             get
             {
@@ -537,12 +559,14 @@
         /// <summary>
         /// 鏄惁涓哄叾浠栦富鐢ㄦ埛鍒嗕韩杩囨潵鐨勪綇瀹�
         /// </summary>
-        public static bool IsOthreShare
+        public bool IsOthreShare
         {
             get
             {
                 return Entity.DB_ResidenceData.Instance.CurrentRegion.isOtherShare;
             }
         }
+
+
     }
 }

--
Gitblit v1.8.0