From 4f2dbd1f6a1ec2d9c3c39b4a37b0b7c9ddece4aa Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期四, 23 九月 2021 15:24:01 +0800 Subject: [PATCH] 主页刷新优化 --- HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs | 77 +++++++++++++++++++++++++++++++++++--- 1 files changed, 71 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..ded7468 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,28 @@ { input = new SecurityInput(); input.sid = function.sid; + + input.condition = new List<SecurityInputCondition>() + { + new SecurityInputCondition() + { + key = "status", + value = "true", + } + }; + + 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 +249,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 +261,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 +294,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 +376,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 +410,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