From 474783457240f62d4f926e628fea2abb1c4b8b0d Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期一, 11 十月 2021 14:53:37 +0800 Subject: [PATCH] spk更新异常,安防中心传感器状态无显示 --- HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs | 100 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 94 insertions(+), 6 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs index 9d0a8c2..969d913 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs @@ -150,6 +150,11 @@ //鍒濆鍊� functions = FunctionList.List.GetArmSensorList(); } + +#if DEBUG + functions.AddRange(FunctionList.List.GetLightList()); +#endif + foreach (var function in functions) { var input = securityAlarm.input.Find((obj) => obj.sid == function.sid); @@ -157,6 +162,51 @@ { input = new SecurityInput(); input.sid = function.sid; + + var inKey = "status"; + var inValue = "true"; + switch(function.spk) + { + case SPK.SensorWater: + inKey = ""; + break; + case SPK.SensorPir: + inKey = "people_status"; + break; + case SPK.SensorSmoke: + inKey = "alarm_status"; + inValue = "alarm"; + break; + case SPK.SensorGas: + inKey = "alarm_status"; + inValue = "alarm"; + break; + case SPK.SensorDoorWindow: + inKey = "contact_status"; + inValue = "open"; + break; + } + input.condition = new List<SecurityInputCondition>() + { + new SecurityInputCondition() + { + key = inKey, + value = inValue, + } + }; + + if (function.spk == SPK.LightSwitch || function.spk == SPK.LightRGB || function.spk == SPK.LightDimming) + { + input.condition = new List<SecurityInputCondition>() + { + new SecurityInputCondition() + { + key = FunctionAttributeKey.OnOff, + value = "off", + } + }; + } + } else { @@ -222,10 +272,10 @@ if(btnChooseIcon.IsSelected) { input.addCondition = true; - if (input.condition.Count==0) - { - ShowStateDialog(input, btnState,btnChooseIcon); - } + //if (input.condition.Count==0) + //{ + // ShowStateDialog(input, btnState,btnChooseIcon,function.spk); + //} } else { @@ -234,7 +284,16 @@ }; btnState.MouseUpEventHandler = (sender, e) => { - ShowStateDialog(input, btnState, btnChooseIcon); + //ShowStateDialog(input, btnState, btnChooseIcon, function.spk); + btnChooseIcon.IsSelected = !btnChooseIcon.IsSelected; + if (btnChooseIcon.IsSelected) + { + input.addCondition = true; + } + else + { + input.addCondition = false; + } }; @@ -258,7 +317,7 @@ } - private void ShowStateDialog(SecurityInput input,Button btnState,Button btnChoose = null) + private void ShowStateDialog(SecurityInput input,Button btnState,Button btnChoose ,string spk) { Dialog dialog = new Dialog(); @@ -340,6 +399,21 @@ value = "true", } }; + + if (spk == SPK.LightSwitch || spk == SPK.LightRGB || spk == SPK.LightDimming) + { + input.condition = new List<SecurityInputCondition>() + { + new SecurityInputCondition() + { + key = FunctionAttributeKey.OnOff, + value = "on", + } + }; + } + + + input.addCondition = true; if (btnChoose != null) { @@ -359,6 +433,20 @@ value = "false", } }; + + if (spk == SPK.LightSwitch || spk == SPK.LightRGB || spk == SPK.LightDimming) + { + input.condition = new List<SecurityInputCondition>() + { + new SecurityInputCondition() + { + key = FunctionAttributeKey.OnOff, + value = "off", + } + }; + } + + input.addCondition = true; if (btnChoose != null) { -- Gitblit v1.8.0