From efad979b6fae76fb37a4de7e94e6bac0a85cb72c Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 30 十一月 2021 13:14:28 +0800
Subject: [PATCH] 2021-11-30 1.修复乐橙Android,没调用拒接接口问题。

---
 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs |  103 ++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 96 insertions(+), 7 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs
index 9d0a8c2..167b453 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs
@@ -86,7 +86,7 @@
             functionListView = new VerticalScrolViewLayout()
             {
                 Y = showdFunctionTypeRow.Bottom,
-                Height = Application.GetRealHeight(530),
+                Height = Application.GetRealHeight(530-60),
                 BackgroundColor = CSS_Color.BackgroundColor,
             };
             bodyView.AddChidren(functionListView);
@@ -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,52 @@
                 {
                     input = new SecurityInput();
                     input.sid = function.sid;
+
+                    var inKey = "status";
+                    var inValue = "true";
+                    switch(function.spk)
+                    {
+                        case SPK.SensorWater:
+                            inKey = "alarm_status";
+                            inValue = "alarm";
+                            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 +273,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 +285,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 +318,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 +400,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 +434,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