From 43b0d5870d528f23ecd6aeceb6cfd4325188b46f Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 01 七月 2021 15:50:43 +0800
Subject: [PATCH] Revert "1"

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs |  102 +++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 82 insertions(+), 20 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
index cd334f8..3cbd448 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -69,6 +69,7 @@
                         }
                     }
                     break;
+                //姘存蹈浼犳劅鍣�
                 case SPK.SensorWater:
                     {
                         LogicView.FunTypeView view = new LogicView.FunTypeView();
@@ -85,7 +86,9 @@
 
                     }
                     break;
+                //鐑熼浘浼犳劅鍣�
                 case SPK.SensorSmoke:
+                //鐕冩皵浼犳劅鍣�
                 case SPK.SensorGas:
                     {
                         LogicView.FunTypeView view = new LogicView.FunTypeView();
@@ -102,6 +105,7 @@
 
                     }
                     break;
+                //骞叉帴鐐�
                 case SPK.SensorDryContact:
                     {
                         LogicView.FunTypeView view = new LogicView.FunTypeView();
@@ -118,8 +122,11 @@
 
                     }
                     break;
+                //绾㈠鐝婃爮浼犳劅鍣�
                 case SPK.SensorShanLan:
+                //绾㈠瀵瑰皠浼犳劅鍣�
                 case SPK.SensorDuiShe:
+                //绾㈠绉诲姩浼犳劅鍣�
                 case SPK.SensorPir:
                     {
                         LogicView.FunTypeView view = new LogicView.FunTypeView();
@@ -135,13 +142,15 @@
                         }
                     }
                     break;
-                case SPK.SensorDoorWindow: {
+                //闂ㄧ獥浼犳劅鍣�
+                case SPK.SensorDoorWindow:
+                    {
                         LogicView.FunTypeView view = new LogicView.FunTypeView();
                         view.btnText.TextID = StringId.kaiqiandbihe;
                         fLayout.AddChidren(view.FLayoutView());
                         view.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
-                            DeviceView(device, view.btnState, StringId.kaiqi , StringId.bihe);
+                            DeviceView(device, view.btnState, StringId.kaiqi, StringId.bihe);
                         };
                         if (edit)
                         {
@@ -149,9 +158,10 @@
                         }
                     }
                     break;
+                //瓒呭0娉紶鎰熷櫒
                 case SPK.SensoruUtrasonic:
                     {
-                        
+
                         LogicView.FunTypeView view = new LogicView.FunTypeView();
                         view.btnText.TextID = StringId.yourenandwuren;
                         fLayout.AddChidren(view.FLayoutView());
@@ -171,6 +181,22 @@
                         if (edit)
                         {
                             GetEditState(device, index, view.btnState, view1.btnState, null, null);
+                        }
+                    }
+                    break;
+                //姣背娉紶鎰熷櫒
+                case SPK.SenesorMegahealth:
+                    {
+                        LogicView.FunTypeView view = new LogicView.FunTypeView();
+                        view.btnText.TextID = StringId.mubiaozhuangtai ;//鐩爣鐘舵��
+                        fLayout.AddChidren(view.FLayoutView());
+                        view.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            DeviceView(device, view.btnState, StringId.wuren, StringId.diedao);
+                        };
+                        if (edit)
+                        {
+                            GetEditState(device, index, view.btnState, null, null, null);
                         }
                     }
                     break;
@@ -214,10 +240,22 @@
                     return;
                 }
                 LogicMethod.RemoveAllView();
-                AddLogic addLogic = new AddLogic();
-                MainPage.BasePageView.AddChidren(addLogic);
-                addLogic.Show();
-                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+
+                if (MainView.IsGatewayType)
+                { //A缃戝叧
+                    var addLogic = new AddLogic();
+                    MainPage.BasePageView.AddChidren(addLogic);
+                    addLogic.Show();
+                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                }
+                else
+                {
+                    //涓�绔彛缃戝叧
+                    var onePortAutomation = new OnePortAutomation();
+                    MainPage.BasePageView.AddChidren(onePortAutomation);
+                    onePortAutomation.Show();
+                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                }
             };
 
             #endregion
@@ -255,6 +293,11 @@
                             keyVlaue = "status";
                         }
                         break;
+                    case SPK.SenesorMegahealth:
+                        {
+                            keyVlaue = "action_state";
+                        }
+                        break;
 
                 }
                 switch (intValue)
@@ -281,12 +324,21 @@
                             value = "off";
                         }
                         break;
-                    case StringId.youren: {
+                    case StringId.youren:
+                        {
                             value = "true";
                         }
                         break;
-                    case StringId.wuren: {
-                            value = "false";
+                    case StringId.wuren:
+                        {
+                            if (device.spk == SPK.SenesorMegahealth)
+                            {
+                                value = "uninhabited";
+                            }
+                            else
+                            {
+                                value = "false";
+                            }
                         }
                         break;
                     case StringId.kaiqi:
@@ -299,20 +351,25 @@
                             value = "close";
                         }
                         break;
-                    case StringId.zaixian: {
+                    case StringId.zaixian:
+                        {
                             keyVlaue = "dismantle";
                             value = "true";
-                        };break;
+                        }; break;
                     case StringId.buzaixian:
                         {
                             keyVlaue = "dismantle";
                             value = "false";
                         }; break;
+                    case StringId.diedao:
+                        {
+                            value = "fall";
+                        }; break;
                 }
                 //鏄剧ず鏂囨湰
                 button.TextID = intValue;
                 selectedState = device.spk + "_" + value;
-                AddDictionary(keyVlaue, value);
+                AddDictionary(keyVlaue, value, "string");
 
             });
 
@@ -344,29 +401,34 @@
         /// </summary>
         /// <param name="KeyValue">璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�</param>
         /// <param name="selectedValue">鐘舵�佸��</param>
-        private void AddDictionary(string KeyValue, string selectedValue)
+        /// <param name="data_type">绫诲瀷</param>
+        /// <param name="comparator">姣旇緝鍏崇郴</param>
+        private void AddDictionary(string KeyValue, string selectedValue,string data_type,string comparator="=")
         {
             //鏁版嵁灏佽
             Dictionary<string, string> dic = new Dictionary<string, string>();
             LogicMethod.dictionary(dic, "key", KeyValue);
-            LogicMethod.dictionary(dic, "comparator", "=");
-            LogicMethod.dictionary(dic, "data_type", "string");
+            LogicMethod.dictionary(dic, "comparator", comparator);
+            LogicMethod.dictionary(dic, "data_type", data_type);
             LogicMethod.dictionary(dic, "value", selectedValue);
-            AddDictionaryList(KeyValue, dic);
+            AddDictionaryList(KeyValue, comparator,dic);
         }
         /// <summary>
         /// 鏇存柊鏁版嵁鍒楄〃
         /// </summary>
-        /// <param name="keyValue">璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�</param> 
+        /// <param name="keyValue">璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�</param>
+        /// <param name="comparator">姣旇緝鍏崇郴</param>
         /// <param name="dictionary">娣诲姞閫変腑鏁版嵁</param>
         /// <returns></returns>
-        private void AddDictionaryList(string keyValue, Dictionary<string, string> dictionary) 
+        private void AddDictionaryList(string keyValue,string comparator, Dictionary<string, string> dictionary) 
         {
             int indexValue = -1;
             for (int i = 0; i < dicSateteList.Count; i++)
             {
                 var dic = dicSateteList[i];
-                if (dic.ContainsValue(keyValue))
+                string key = dic["key"];
+                string comparatorValue = dic["comparator"];
+                if (key == keyValue && comparatorValue == comparator)
                 {
                     //鍒ゆ柇鏄惁瀛樺湪
                     indexValue = i;

--
Gitblit v1.8.0