| | |
| | | //初始值 |
| | | 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); |
| | |
| | | { |
| | | 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 |
| | | { |
| | |
| | | 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 |
| | | { |
| | |
| | | }; |
| | | 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; |
| | | } |
| | | }; |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | 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(); |
| | | |
| | |
| | | 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) |
| | | { |
| | |
| | | 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) |
| | | { |