From 41f9c8837b0551c68f8fd798c06951fa716b7ab8 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期一, 11 一月 2021 14:05:29 +0800
Subject: [PATCH] Merge branch 'NewFilePath' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into NewFilePath

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs |   66 +++++++++++++++++++++++----------
 1 files changed, 46 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 4339acb..6d5a498 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -1,4 +1,4 @@
-锘縰sing System;
+using System;
 using Shared;
 using System.Collections.Generic;
 using HDL_ON.Entity;
@@ -19,10 +19,6 @@
         /// 瀹氫箟涓�涓彉閲忥紝璁板綍閫変腑鐘舵��
         /// </summary>
         private string selectedState = "unknown";
-        /// <summary>
-        /// 瀹氫箟涓�涓彉閲忥紝璁板綍閫変腑鐘舵�佽褰曞睘鎬�
-        /// </summary>
-        private string keyVlaue = "";
         public void Show(Entity.Function device, int index, bool edit)
         {
             #region 鐣岄潰甯冨眬
@@ -70,7 +66,31 @@
                                 BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                             };
                             this.AddChidren(frame);
-                            SwitchViewMethod(frame, device, lightSwitchView.btnState, 2);
+                            LogicView.SwitchView switchView = new LogicView.SwitchView();
+                            switchView.FLayoutView(frame, 2, lightSwitchView.btnState.Text, (strValue) =>
+                            {
+                                int id = 0;
+                                switch (strValue)
+                                {
+                                    case "on":
+                                        {
+                                            id = StringId.onLogic;
+                                        }
+                                        break;
+                                    case "off":
+                                        {
+                                            id = StringId.offLogic;
+                                        }
+                                        break;
+                                }
+                                //鏄剧ず鏂囨湰
+                                lightSwitchView.btnState.TextID = id;
+                                selectedState = device.functionType + "_" + strValue;
+                                //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�;
+                                string keyVlaue = "on_off";
+                                AddDictionary(keyVlaue, strValue);
+
+                            });
                         };
                         if (edit)
                         {
@@ -89,8 +109,6 @@
             this.AddChidren(saveView.FLayoutView());
             saveView.btnClick.MouseUpEventHandler += (sen, e) =>
             {
-
-
                 if (selectedState != "unknown")
                 {
                     Input inputDevice = new Input();
@@ -179,7 +197,7 @@
         /// <param name="button2">鏄剧ずBtn</param>
         /// <param name="button3">鏄剧ずBtn</param>
         /// <param name="button4">鏄剧ずBtn</param>
-        private void GetEditState(Entity.Function device , int index, Button button1, Button button2, Button button3, Button button4)
+        private void GetEditState(Entity.Function device, int index, Button button1, Button button2, Button button3, Button button4)
         {
             Input inputs = Logic.currlogic.input[index];
             var dicList = inputs.condition as List<Dictionary<string, string>>;
@@ -223,15 +241,31 @@
                     break;
 
             }
+            InpOrOutLogicMethod.EditState(device, dicList, button1, button2, button3, button4);
         }
         /// <summary>
         /// 娣诲姞閫変腑鏁版嵁
         /// </summary>
-        /// <param name="dicList">瀛樺偍鏁版嵁鍒楄〃</param>
-        /// <param name="keyValue">璇嗗埆璁惧</param> 
+        /// <param name="KeyValue">璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�</param>
+        /// <param name="selectedValue">鐘舵�佸��</param>
+        private void AddDictionary(string KeyValue, string selectedValue)
+        {
+            //鏁版嵁灏佽
+            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, "value", selectedValue);
+            AddDictionaryList(KeyValue, dic, dicSateteList);
+        }
+        /// <summary>
+        /// 鏇存柊鏁版嵁鍒楄〃
+        /// </summary>
+        /// <param name="keyValue">璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�</param> 
         /// <param name="dictionary">閫変腑鏁版嵁</param>
+        /// <param name="dicList">瀛樺偍鏁版嵁鍒楄〃</param>
         /// <returns></returns>
-        private void AddDictionaryData(List<Dictionary<string, string>> dicList, string keyValue, Dictionary<string, string> dictionary)
+        private void AddDictionaryList(string keyValue, Dictionary<string, string> dictionary, List<Dictionary<string, string>> dicList)
         {
             int indexValue = -1;
             for (int i = 0; i < dicList.Count; i++)
@@ -285,14 +319,6 @@
                 Logic.currlogic.input.Add(input);
             }
 
-        }
-        /// <summary>
-        /// 绉婚櫎鎺т欢
-        /// </summary>
-        /// <param name="frame"></param>
-        private void RemView(FrameLayout frame)
-        {
-            frame.RemoveFromParent();
         }
     }
 }

--
Gitblit v1.8.0