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