From 263401d40b2d9d2c1b36a24f33d45c5cb7192518 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 23 十二月 2020 15:51:54 +0800
Subject: [PATCH] 20201223-6

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs |  109 ++++++++++++++++++++++++++----------------------------
 1 files changed, 53 insertions(+), 56 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
old mode 100644
new mode 100755
index 1db4522..bb24069
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -46,12 +46,12 @@
                 case FunctionType.Dimmer:
                 case FunctionType.RGB:
                 case FunctionType.RGBW:
-                case FunctionType.CCT:
+                case FunctionType.ColorTemperature:
                 case FunctionType.Relay:
                 //绐楀笜
                 case FunctionType.Curtain:
-                case FunctionType.RollerCurtain:
-                case FunctionType.TrietexCurtain:
+                case FunctionType.RollingShutter:
+                case FunctionType.MotorCurtain:
                 //绌鸿皟
                 case FunctionType.AC:
                 //鍦扮儹
@@ -72,15 +72,11 @@
                         };
                         if (edit)
                         {
-                            GetEditState(device, edit, index, lightSwitchView.btnState, null, null, null);
+                            GetEditState(device, index, lightSwitchView.btnState, null, null, null);
                         }
 
                     }
                     break;
-
-
-
-
 
             }
             #region  淇濆瓨
@@ -133,39 +129,77 @@
 
         }
         /// <summary>
-        /// 绉婚櫎鎺т欢
+        /// 寮�鍏冲姛鑳藉睍寮�鐣岄潰
         /// </summary>
         /// <param name="frame"></param>
-        private void RemView(FrameLayout frame)
+        /// <param name="device"></param>
+        /// <param name="button"></param>
+        /// <param name="len"></param>
+        public void SwitchViewMethod(FrameLayout frame, Entity.Function device, Button button, int len)
         {
-            frame.RemoveFromParent();
+
+            LogicView.SwitchView switchView = new LogicView.SwitchView();
+            switchView.FLayoutView(frame, len, button.Text, (strValue) =>
+            {
+                int id = 0;
+                switch (strValue)
+                {
+                    case "on":
+                        {
+                            id = StringId.onLogic;
+                        }
+                        break;
+                    case "off":
+                        {
+                            id = StringId.offLogic;
+                        }
+                        break;
+                }
+                button.TextID = id;
+                keyVlaue = "on_off";
+                Dictionary<string, string> dic = new Dictionary<string, string>();
+                LogicMethod.dictionary(dic, "key", "on_off");
+                LogicMethod.dictionary(dic, "comparator", "=");
+                LogicMethod.dictionary(dic, "data_type", "string");
+                LogicMethod.dictionary(dic, "value", strValue);
+                AddDictionaryData(dicSateteList, keyVlaue, dic);
+                selectedState = device.functionType + "_" + strValue;
+
+            });
+
         }
         /// <summary>
         /// 鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
         /// </summary>
         /// <param name="device">缂栬緫璁惧</param>
-        /// <param name="edit">缂栬緫鐘舵��</param>
         /// <param name="index">缂栬緫鏁版嵁鐨勭储寮�</param>
         /// <param name="button1">鏄剧ずBtn</param>
         /// <param name="button2">鏄剧ずBtn</param>
         /// <param name="button3">鏄剧ずBtn</param>
         /// <param name="button4">鏄剧ずBtn</param>
-        private void GetEditState(Entity.Function device, bool edit, 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>>;
+            //娓呴櫎涔嬪墠鏃ф暟鎹�
+            dicSateteList.Clear();
+            if (dicList.Count != 0)
+            {
+                //鏈夋暟鎹噸鏂拌祴鍊�
+                dicSateteList = dicList;
+            }
             switch (device.functionType)
             {
                 //寮�鍏崇伅鍏� light.Switch
                 case FunctionType.Dimmer:
                 case FunctionType.RGB:
                 case FunctionType.RGBW:
-                case FunctionType.CCT:
+                case FunctionType.ColorTemperature:
                 case FunctionType.Relay:
                 //绐楀笜
                 case FunctionType.Curtain:
-                case FunctionType.RollerCurtain:
-                case FunctionType.TrietexCurtain:
+                case FunctionType.RollingShutter:
+                case FunctionType.MotorCurtain:
                 //绌鸿皟
                 case FunctionType.AC:
                 //鍦扮儹
@@ -251,49 +285,12 @@
 
         }
         /// <summary>
-        /// 寮�鍏冲姛鑳藉睍寮�鐣岄潰
+        /// 绉婚櫎鎺т欢
         /// </summary>
         /// <param name="frame"></param>
-        /// <param name="device"></param>
-        /// <param name="button"></param>
-        /// <param name="len"></param>
-        public void SwitchViewMethod(FrameLayout frame, Entity.Function device, Button button, int len)
+        private void RemView(FrameLayout frame)
         {
-
-            LogicView.SwitchView switchView = new LogicView.SwitchView();
-            switchView.FLayoutView(frame, len);
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            LogicMethod.dictionary(dic, "key", "on_off");
-            LogicMethod.dictionary(dic, "comparator", "=");
-            LogicMethod.dictionary(dic, "data_type", "string");
-            keyVlaue = "on_off";
-            switchView.btnOn.MouseUpEventHandler += (sender2, e2) =>
-            {
-                LogicMethod.dictionary(dic, "value", "on");
-                RemView(frame);
-                button.TextID = StringId.onLogic;
-                selectedState = device.functionType + "_on";
-                AddDictionaryData(dicSateteList, keyVlaue, dic);
-            };
-            switchView.btnOff.MouseUpEventHandler += (sender3, e3) =>
-            {
-                LogicMethod.dictionary(dic, "value", "off");
-                RemView(frame);
-                button.TextID = StringId.offLogic;
-                selectedState = device.functionType + "_off";
-                AddDictionaryData(dicSateteList, keyVlaue, dic);
-            };
-            if (button.Text != "")
-            {
-                if (button.Text == switchView.btnOn.Text)
-                {
-                    switchView.btnOn.TextColor = CSS.CSS_Color.textConfirmColor;
-                }
-                else if (button.Text == switchView.btnOff.Text)
-                {
-                    switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor;
-                }
-            }
+            frame.RemoveFromParent();
         }
     }
 }

--
Gitblit v1.8.0