From b4f5f74d74a0a0996358d8348956601b30f17266 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 08 十二月 2021 16:07:51 +0800 Subject: [PATCH] 隐藏安防 --- HDL_ON/Entity/Function/SecurityAlarm.cs | 137 +++++++++++++++++++++++++++++++++++++-------- 1 files changed, 112 insertions(+), 25 deletions(-) diff --git a/HDL_ON/Entity/Function/SecurityAlarm.cs b/HDL_ON/Entity/Function/SecurityAlarm.cs index a460369..ea29373 100644 --- a/HDL_ON/Entity/Function/SecurityAlarm.cs +++ b/HDL_ON/Entity/Function/SecurityAlarm.cs @@ -470,7 +470,7 @@ /// 1:鍦烘櫙 /// 2:鑷姩鍖� /// </summary> - public string target_type ="0"; + public string target_type = "0"; /// <summary> /// 杈撳嚭鐩爣鐨剆id /// </summary> @@ -480,32 +480,108 @@ /// </summary> public List<SecurityOutputStatus> status = new List<SecurityOutputStatus>(); - /// <summary> - /// 鍔犲叆杈撳叆鏉′欢 - /// 鏈湴鍒ゆ柇浣跨敤 + /// 鏈湴涓嶅瓨鍦ㄦ暟鎹紙鏁版嵁鍙兘琚垹浜嗭級 /// </summary> - //[Newtonsoft.Json.JsonIgnore] - //public bool addCondition = false; - - [Newtonsoft.Json.JsonIgnore] - public string name = ""; - [Newtonsoft.Json.JsonIgnore] - public string RoomName = ""; - - [Newtonsoft.Json.JsonIgnore] - Function _function = null; - /// <summary> - /// 瀵瑰簲鐨勫姛鑳藉璞� - /// </summary> - /// <returns></returns> - public Function GetFunction() + public bool NoLocalData () { - if (_function == null) + var function = FunctionList.List.GetLightList().Find((obj) => obj.sid == sid); + if (function != null) { - _function = FunctionList.List.Functions.Find((obj) => obj.sid == sid); + return true; } - return _function; + else + { + var scene = FunctionList.List.scenes.Find((obj) => obj.sid == sid); + if (scene != null) + { + return true; + } + } + return false; + } + + + string _name; + [Newtonsoft.Json.JsonIgnore] + public string name + { + get + { + if (string.IsNullOrEmpty(_name)) + { + + var function = FunctionList.List.GetLightList().Find((obj) => obj.sid == sid); + if (function != null) + { + _name = function.name; + } + else + { + var scene = FunctionList.List.scenes.Find((obj) => obj.sid == sid); + if (scene != null) + { + _name = scene.name; + } + } + } + return _name; + } + set + { + _name = value; + } + } + + + + string _roomName; + [Newtonsoft.Json.JsonIgnore] + public string RoomName + { + get + { + if (string.IsNullOrEmpty(_roomName)) + { + + var function = FunctionList.List.GetLightList().Find((obj) => obj.sid == sid); + if (function != null) + { + _roomName = function.GetRoomListName(); + } + else + { + var scene = FunctionList.List.scenes.Find((obj) => obj.sid == sid); + if (scene != null) + { + _roomName = scene.GetRoomListName(); + } + } + } + return _roomName; + } + set + { + _roomName = value; + } + } + + string _spk; + [Newtonsoft.Json.JsonIgnore] + public string spk + { + get + { + if (string.IsNullOrEmpty(_spk)) + { + var function = FunctionList.List.GetLightList().Find((obj) => obj.sid == sid); + if (function != null) + { + _spk = function.spk; + } + } + return _spk; + } } @@ -518,7 +594,7 @@ string text = ""; if (target_type == "0") { - switch (GetFunction().spk) + switch (spk) { case SPK.LightDimming: case SPK.LightCCT: @@ -526,7 +602,18 @@ case SPK.LightSwitch: foreach (var state in status) { - if (state.key == FunctionAttributeKey.Brightness) + if(state.key == FunctionAttributeKey.OnOff) + { + if (state.value == "off") + { + text = Language.StringByID(StringId.Close); + } + else + { + text = Language.StringByID(StringId.Open); + } + } + else if (state.key == FunctionAttributeKey.Brightness) { if (state.value == "0") { @@ -583,7 +670,7 @@ /// APP:app push /// SMS:鐭俊 /// </summary> - public string pushMethod; + public string pushMethod = "APP"; /// <summary> /// 鎺ㄩ�佺洰鏍� /// </summary> -- Gitblit v1.8.0