From 4ad6d53e2a8dc59d99405a053ddc46f49ae7a1b3 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期四, 14 十月 2021 11:55:51 +0800 Subject: [PATCH] 干接点新spk 兼容问题 --- HDL_ON/Entity/Function/SecurityAlarm.cs | 47 +++++++++++++++++++---------------------------- 1 files changed, 19 insertions(+), 28 deletions(-) diff --git a/HDL_ON/Entity/Function/SecurityAlarm.cs b/HDL_ON/Entity/Function/SecurityAlarm.cs index 1ebe9f8..68cc8d8 100644 --- a/HDL_ON/Entity/Function/SecurityAlarm.cs +++ b/HDL_ON/Entity/Function/SecurityAlarm.cs @@ -7,17 +7,17 @@ namespace HDL_ON.Entity { - public class SecurityCenter + public class SecurityCenter111111 { - static SecurityCenter _securityCenter; + static SecurityCenter111111 _securityCenter; - public static SecurityCenter Ins + public static SecurityCenter111111 Ins { get { if (_securityCenter == null) { - _securityCenter = new SecurityCenter(); + _securityCenter = new SecurityCenter111111(); } return _securityCenter; } @@ -30,14 +30,11 @@ { get { - foreach (var temp in FunctionList.List.securities) + lock (FunctionList.List.securities) { - if (temp.status == "enable") - { - return true; - } + var temp = FunctionList.List.securities.Find((obj) => obj.status == "enable"); + return temp == null ? false : true; } - return false; } } @@ -48,14 +45,11 @@ { get { - foreach (var temp in FunctionList.List.securities) + lock (FunctionList.List.securities) { - if (temp.alarm) - { - return true; - } + var temp = FunctionList.List.securities.Find((obj) => obj.alarm == true); + return temp == null ? false : true; } - return false; } } @@ -69,13 +63,10 @@ { if (_inDefenseMode == null) { - foreach (var temp in FunctionList.List.securities) + lock (FunctionList.List.securities) { - if (temp.status == "enable") - { - _inDefenseMode = temp; - return _inDefenseMode; - } + var temp = FunctionList.List.securities.Find((obj) => obj.status == "enable"); + return temp; } } return _inDefenseMode; @@ -436,11 +427,11 @@ case SPK.SensorSmoke: foreach (var con in condition) { - if (con.value == "true") + if (con.value == "true" || con.value == "alarm") { text += Language.StringByID(StringId.InAlarm) + " "; } - else if (con.value == "false") + else if (con.value == "false" || con.value == "normal") { text += Language.StringByID(StringId.Normal) + " "; } @@ -462,11 +453,11 @@ case SPK.SensorWater: foreach (var con in condition) { - if (con.value == "true") + if (con.value == "true" || con.value == "alarm") { text += Language.StringByID(StringId.WaterLeakage) + " "; } - else if (con.value == "false") + else if (con.value == "false" || con.value == "normal") { text += Language.StringByID(StringId.Normal) + " "; } @@ -475,11 +466,11 @@ case SPK.SensorDoorWindow: foreach (var con in condition) { - if (con.value == "true") + if (con.value == "true" || con.value == "open") { text += Language.StringByID(StringId.Open) + " "; } - else if (con.value == "false") + else if (con.value == "false" || con.value == "close") { text += Language.StringByID(StringId.Close) + " "; } -- Gitblit v1.8.0