From f9f9b0030fdd2691632569b7dcad9d0ddca5e4cf Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期三, 23 十二月 2020 09:28:54 +0800
Subject: [PATCH] 2020-12-23 1.调整mqtt挤下线,跑ui线程。2.LoadEvent_CheckLinkStatus方法调整

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs |  142 ++++++++++++++++++-----------------------------
 1 files changed, 54 insertions(+), 88 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 909a6ba..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,16 +72,12 @@
                         };
                         if (edit)
                         {
-                            GetEditState(device, edit, index, lightSwitchView.btnState, null, null, null);
+                            GetEditState(device, index, lightSwitchView.btnState, null, null, null);
                         }
 
                     }
                     break;
-           
-              
-               
-               
-          
+
             }
             #region  淇濆瓨
             ///淇濆瓨View
@@ -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,80 +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);
-
-            Button btnOn = new Button
-            {
-                TextAlignment = TextAlignment.Center,
-                TextSize = LogicView.TextSize.text16,
-                TextColor = CSS.CSS_Color.textCancelColor,
-                TextID = StringId.onLogic,
-                Height = Application.GetRealHeight(44),
-                Width = Application.GetRealWidth(343),
-
-            };
-            switchView.frameLayout.AddChidren(btnOn);
-            Button btnLine = new Button
-            {
-                Height = 1,
-                BackgroundColor = CSS.CSS_Color.viewLine,
-                Y = btnOn.Bottom,
-            };
-            switchView.frameLayout.AddChidren(btnLine);
-            Button btnOff = new Button
-            {
-                Y = btnLine.Bottom,
-                TextAlignment = TextAlignment.Center,
-                TextSize = LogicView.TextSize.text16,
-                TextColor = CSS.CSS_Color.textCancelColor,
-                TextID = StringId.offLogic,
-                Height = Application.GetRealHeight(44),
-                Width = Application.GetRealWidth(343),
-            };
-            switchView.frameLayout.AddChidren(btnOff);
-
-            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";
-            btnOn.MouseUpEventHandler += (sender2, e2) =>
-            {
-                LogicMethod.dictionary(dic, "value", "on");
-                RemView(frame);
-                button.TextID = StringId.onLogic;
-                selectedState = device.functionType + "_on";
-                AddDictionaryData(dicSateteList, keyVlaue, dic);
-            };
-            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 == btnOn.Text)
-                {
-                    btnOn.TextColor = CSS.CSS_Color.textConfirmColor;
-                }
-                else
-                {
-                    btnOff.TextColor = CSS.CSS_Color.textConfirmColor;
-                }
-            }
+            frame.RemoveFromParent();
         }
     }
 }

--
Gitblit v1.8.0