From f25c6122eb7e26be5e7f036cf29b9019c4953be2 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 21 十二月 2020 19:44:02 +0800
Subject: [PATCH] Merge branch 'WJC' into NewFilePath

---
 HDL-ON_Android/Assets/Language.ini                                  |    1 
 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs   |   85 ++++-----
 HDL_ON/HDL_ON.projitems                                             |    2 
 HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs      |  178 ++++++----------------
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/brightnessView.cs |   99 +++++++++++-
 HDL-ON_iOS/Resources/Language.ini                                   |    1 
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/.DS_Store         |    0 
 HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs                      |    4 
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs              |    2 
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs     |   74 +++++++++
 HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs                 |   10 +
 HDL_ON/UI/UI2/3-Intelligence/Automation/.DS_Store                   |    0 
 HDL_ON/Common/R.cs                                                  |    2 
 13 files changed, 270 insertions(+), 188 deletions(-)

diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini
index a44ca71..344421e 100644
--- a/HDL-ON_Android/Assets/Language.ini
+++ b/HDL-ON_Android/Assets/Language.ini
@@ -537,6 +537,7 @@
 7076=鐩爣涓嶈兘涓虹┖銆�
 7077=鏃堕棿鏈缃紝璇疯缃椂闂淬��
 7078=鏉′欢鎴栬�呯洰鏍囦负绌恒��
+7079=缃戝叧涓嶅湪绾�
 
 9000=璇蜂娇鐢ㄦ柊鐨勬墜鏈鸿处鍙风櫥褰旳PP
 9001=璇蜂娇鐢ㄦ柊鐨勯偖绠辫处鍙风櫥褰旳PP
diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini
index 794d117..791eae6 100644
--- a/HDL-ON_iOS/Resources/Language.ini
+++ b/HDL-ON_iOS/Resources/Language.ini
@@ -537,6 +537,7 @@
 7076=鐩爣涓嶈兘涓虹┖銆�
 7077=鏃堕棿鏈缃紝璇疯缃椂闂淬��
 7078=鏉′欢鎴栬�呯洰鏍囦负绌恒��
+7079=缃戝叧涓嶅湪绾�
 
 9000=璇蜂娇鐢ㄦ柊鐨勬墜鏈鸿处鍙风櫥褰旳PP
 9001=璇蜂娇鐢ㄦ柊鐨勯偖绠辫处鍙风櫥褰旳PP
diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs
index a33898a..e1987e7 100644
--- a/HDL_ON/Common/R.cs
+++ b/HDL_ON/Common/R.cs
@@ -531,7 +531,7 @@
         public const int targetNull = 7076;
         public const int timeNoSet = 7077;
         public const int conditioncNullOrtargetNull = 7078;
-
+        public const int gatewayNotOnline = 7079;
 
 
 
diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems
index dd57932..29a4403 100644
--- a/HDL_ON/HDL_ON.projitems
+++ b/HDL_ON/HDL_ON.projitems
@@ -248,7 +248,6 @@
     <Compile Include="$(MSBuildThisFileDirectory)Common\ImageUtlis.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\ConditionDeviceFunList.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\TargetDeviceFunList.cs" />
-    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\brightnessView.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\FunTypeView.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\CheckView.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Common\FileUtlis.cs" />
@@ -267,6 +266,7 @@
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Light\ColorTureLampPageBLL.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Common\Utlis\FloorRoomSelectPopupView.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Public\Widget\DiySelectPopupDialog.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\LogicView\BrightnessView.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="$(MSBuildThisFileDirectory)UI\" />
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/.DS_Store b/HDL_ON/UI/UI2/3-Intelligence/Automation/.DS_Store
index 771fadd..641e1de 100755
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/.DS_Store
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/.DS_Store
Binary files differ
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
index 3c54d9b..f6bb95b 100755
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
@@ -258,6 +258,10 @@
                                         LogicMethod.RemoveAllView();
                                         MainView.MainShow();
                                     }
+                                    else if (responsePackNew != null && responsePackNew.Code == "14005")
+                                    {
+                                        new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline));
+                                    }
                                     else
                                     {
                                         new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail));
@@ -294,7 +298,11 @@
                                     LogicMethod.RemoveAllView();
                                     MainView.MainShow();
                                 }
-                                else
+                                else if (responsePackNew != null && responsePackNew.Code == "14005")
+                                {
+                                    new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline));
+                                }
+                                else 
                                 {
                                     new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail));
                                 }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
index ce1e8f8..bb24069 100755
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -78,10 +78,6 @@
                     }
                     break;
 
-
-
-
-
             }
             #region  淇濆瓨
             ///淇濆瓨View
@@ -133,12 +129,44 @@
 
         }
         /// <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>
         /// 鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
@@ -257,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");
-                button.TextID = StringId.onLogic;
-                selectedState = device.functionType + "_on";
-                AddDictionaryData(dicSateteList, keyVlaue, dic);
-                RemView(frame);
-            };
-            switchView.btnOff.MouseUpEventHandler += (sender3, e3) =>
-            {
-                LogicMethod.dictionary(dic, "value", "off");
-                button.TextID = StringId.offLogic;
-                selectedState = device.functionType + "_off";
-                AddDictionaryData(dicSateteList, keyVlaue, dic);
-                RemView(frame);
-            };
-            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();
         }
     }
 }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index f93ff6c..8a0f17e 100755
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -5,7 +5,7 @@
 namespace HDL_ON.UI.UI2.Intelligence.Automation
 {
 
-    public class LogicMethod
+    public  class  LogicMethod
     {
         /// <summary>
         /// 琛ㄧず鏄潯浠�
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/.DS_Store b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/.DS_Store
index 5008ddf..afb4543 100755
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/.DS_Store
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/.DS_Store
Binary files differ
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs
index df964b6..078ef48 100755
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs
@@ -91,13 +91,17 @@
             Width = Application.GetRealWidth(343),
         };
 
+
+
         /// <summary>
         /// View鐨勬柟娉�
         /// </summary>
         ///  <param name="frame">鐖舵帶浠�</param>
         /// <param name="i">鏄剧ず閫夋嫨View鏁伴噺</param>
+        ///<param name="stateVuale">涔嬪墠鐨勭姸鎬佸��</param>
+        /// <param name="action">杩斿洖鍥炶皟</param>
         /// <returns></returns>
-        public void FLayoutView(FrameLayout frame, int i)
+        public void FLayoutView(FrameLayout frame, int i,string stateVuale,Action<string>action)
         {
             frameLayout.Y = Application.GetRealHeight(603 - (44 * i));
             frameLayout.Height = Application.GetRealHeight(44 * i);
@@ -112,11 +116,79 @@
                 frameLayout.AddChidren(btnLine1);
                 frameLayout.AddChidren(btnStop);
             }
+            //鍙栨秷鐐瑰嚮浜嬩欢
             btnCancel.MouseUpEventHandler += (sender1, e1) =>
             {
                 frame.RemoveFromParent();
             };
 
+
+            ///鏄剧ず涔嬪墠鐘舵��
+            if (stateVuale != "")
+            {
+                if (stateVuale ==btnOn.Text)
+                {
+                    btnOn.TextColor = CSS.CSS_Color.textConfirmColor;
+                }
+                else if (stateVuale == btnOff.Text)
+                {
+                    btnOff.TextColor = CSS.CSS_Color.textConfirmColor;
+                }
+                else if (stateVuale == btnStop.Text)
+                {
+                    btnStop.TextColor = CSS.CSS_Color.textConfirmColor;
+                }
+            }
+
+            //寮�-鐐瑰嚮浜嬩欢
+            btnOn.MouseUpEventHandler += (sender2, e2) =>
+            {
+                action("on");
+                frame.RemoveFromParent();
+            };
+            //鍏�-鐐瑰嚮浜嬩欢
+            btnOff.MouseUpEventHandler += (sender3, e3) =>
+            {
+                action("off");
+                frame.RemoveFromParent();
+            };
+            //鏆傚仠-鐐瑰嚮浜嬩欢
+            btnStop.MouseUpEventHandler += (sender3, e3) =>
+            {
+                action("stop");
+                frame.RemoveFromParent();
+            };
+
         }
+
+
+
+
+        ///// <summary>
+        ///// View鐨勬柟娉�
+        ///// </summary>
+        /////  <param name="frame">鐖舵帶浠�</param>
+        ///// <param name="i">鏄剧ず閫夋嫨View鏁伴噺</param>
+        ///// <returns></returns>
+        //public void FLayoutView(FrameLayout frame, int i)
+        //{
+        //    frameLayout.Y = Application.GetRealHeight(603 - (44 * i));
+        //    frameLayout.Height = Application.GetRealHeight(44 * i);
+        //    frame.AddChidren(frameLayout);
+        //    frame.AddChidren(btnCancel);
+        //    frameLayout.AddChidren(btnOn);
+        //    frameLayout.AddChidren(btnLine);
+        //    frameLayout.AddChidren(btnOff);
+        //    if (i > 2)
+        //    {
+        //        /// 鍒ゆ柇鏄惁瑕佹槸鏄剧ず"鏆傚仠"鎸夐挳
+        //        frameLayout.AddChidren(btnLine1);
+        //        frameLayout.AddChidren(btnStop);
+        //    }
+        //    btnCancel.MouseUpEventHandler += (sender1, e1) =>
+        //    {
+        //        frame.RemoveFromParent();
+        //    };
+        //}
     }
 }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/brightnessView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/brightnessView.cs
index 70dcbe9..ef6ceed 100755
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/brightnessView.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/brightnessView.cs
@@ -72,22 +72,22 @@
         /// </summary>
         public Button btn_subtract_click = new Button
         {
-            Width = Application.GetMinRealAverage(24+20),
+            Width = Application.GetMinRealAverage(24 + 20),
             Height = Application.GetMinRealAverage(24),
-            X = Application.GetRealWidth(26-20),
+            X = Application.GetRealWidth(26 - 20),
             Y = Application.GetRealHeight(118),
 
         };
         public DiyImageSeekBar seekBarVol = new DiyImageSeekBar
         {
             Y = Application.GetRealHeight(103),//杩涘害鏉$埗鎺т欢Y鍧愭爣
-            X = Application.GetRealWidth(62-10),//杩涘害鏉鍧愭爣
-            SeekBarPadding=Application.GetRealHeight(10),//杩涘害鏉″疄闄呴暱搴�=244-10*2(鍐呰竟璺�);
+            X = Application.GetRealWidth(62 - 10),//杩涘害鏉鍧愭爣
+            SeekBarPadding = Application.GetRealHeight(10),//杩涘害鏉″疄闄呴暱搴�=244-10*2(鍐呰竟璺�);
             Width = Application.GetRealWidth(240),//杩涘害鏉$殑闀垮害
             Height = Application.GetRealHeight(54),//杩涘害鏉$埗鎺т欢楂樺害
             IsProgressTextShow = true,//鏄剧ず鐧惧垎姣�
             IsClickable = true,//杩涘害鏉℃槸鍚︽粦鍔�
-            ProgressBarColor =CSS.CSS_Color.textConfirmColor,//閫変腑杩涘害鏉¢鑹�
+            ProgressBarColor = CSS.CSS_Color.textConfirmColor,//閫変腑杩涘害鏉¢鑹�
             ThumbImagePath = "LogicIcon/point.png",//杩涘害鏉℃寜閽浘鏍�
             ThumbImageHeight = Application.GetRealHeight(54),//杩涘害鏉℃寜閽浘鏍囩殑楂樺害锛堥粯璁ゆ鏂瑰舰锛氬鍜岄珮涓�鏍凤級
             ProgressTextColor = CSS.CSS_Color.textColor,
@@ -111,16 +111,22 @@
         /// </summary>
         public Button btn_add_click = new Button
         {
-            Width = Application.GetMinRealAverage(24+20),
+            Width = Application.GetMinRealAverage(24 + 20),
             Height = Application.GetMinRealAverage(24),
             X = Application.GetRealWidth(294),
             Y = Application.GetRealHeight(118),
         };
+
+
+
         /// <summary>
         /// View鐨勬柟娉�
         /// </summary>
-        /// <param name="fLayout"></param>
-        public void FLayoutView(FrameLayout fLayout)
+        /// <param name="fLayout">鐖舵帶浠�</param>
+        /// <param name="titleName">鏍囬鍚嶇О</param>
+        /// <param name="stateValue">涔嬪墠鐘舵�佸��</param>
+        /// <param name="action">杩斿洖鍥炶皟</param>
+        public void FLayoutView(FrameLayout fLayout, string titleName,string stateValue, Action<string> action)
         {
             fLayout.AddChidren(frameLayout);
             frameLayout.AddChidren(btnTitle);
@@ -131,13 +137,90 @@
             frameLayout.AddChidren(seekBarVol);
             frameLayout.AddChidren(btn_add);
             frameLayout.AddChidren(btn_add_click);
+            //绗竴涓彉鍖栬褰曢�変腑鍊�
+            int brightnesValue = 0;
+            if (stateValue != "")
+            {
+                try
+                {
+                    //杩涙潵鐨勭姸鎬�
+                    brightnesValue = int.Parse(stateValue);
+                    seekBarVol.Progress = int.Parse(stateValue);
+                }
+                catch { }
+            }
+            //鈥旂偣鍑讳簨浠�
+            btn_subtract_click.MouseUpEventHandler += (sender2, e2) =>
+            {
+                if (brightnesValue > 0)
+                {
+                    brightnesValue -= 1;
+                    seekBarVol.Progress = brightnesValue;
+                }
+            };
+            //+鐐瑰嚮浜嬩欢
+            btn_add_click.MouseUpEventHandler += (sende2, e2) =>
+            {
+                if (brightnesValue < 100)
+                {
+                    brightnesValue += 1;
+                    seekBarVol.Progress = brightnesValue;
+
+                }
+            };
+            //杩涘害鏉℃粦鍔ㄧ偣鍑讳簨浠�
+            EventHandler<int> progressclick = (sender2, e2) =>
+            {
+                brightnesValue = seekBarVol.Progress;
+            };
+            seekBarVol.OnProgressChangedEvent += progressclick;
+            seekBarVol.OnStopTrackingTouchEvent += progressclick;
             //鍙栨秷鐐瑰嚮浜嬩欢
             btnCancel.MouseUpEventHandler += (sender, e1) =>
             {
                 //绉婚櫎fLayout鐣岄潰
                 fLayout.RemoveFromParent();
             };
+            //纭畾鐐瑰嚮浜嬩欢
+            btnConfirm.MouseUpEventHandler += (sender, e1) =>
+            {
+                //if (brightnesValue == 0)
+                //{
+                //    return;
+                //}
+                action(brightnesValue.ToString());
+                //绉婚櫎fLayout鐣岄潰
+                fLayout.RemoveFromParent();
+            };
+
 
         }
+
+
+
+
+        ///// <summary>
+        ///// View鐨勬柟娉�
+        ///// </summary>
+        ///// <param name="fLayout"></param>
+        //public void FLayoutView(FrameLayout fLayout)
+        //{
+        //    fLayout.AddChidren(frameLayout);
+        //    frameLayout.AddChidren(btnTitle);
+        //    frameLayout.AddChidren(btnCancel);
+        //    frameLayout.AddChidren(btnConfirm);
+        //    frameLayout.AddChidren(btn_subtract);
+        //    frameLayout.AddChidren(btn_subtract_click);
+        //    frameLayout.AddChidren(seekBarVol);
+        //    frameLayout.AddChidren(btn_add);
+        //    frameLayout.AddChidren(btn_add_click);
+        //    //鍙栨秷鐐瑰嚮浜嬩欢
+        //    btnCancel.MouseUpEventHandler += (sender, e1) =>
+        //    {
+        //        //绉婚櫎fLayout鐣岄潰
+        //        fLayout.RemoveFromParent();
+        //    };
+
+        //}
     }
 }
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs
index 213d4ad..507e495 100755
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs
@@ -122,6 +122,10 @@
                                     MainView.MainShow();
                                     //鍙戦�佸垹闄ら�昏緫鍛戒护锛�
                                 }
+                                else if (responsePackNew != null && responsePackNew.Code == "14005")
+                                {
+                                    new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline));
+                                }
                                 else
                                 {
                                     new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.delFail));
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
index 236032e..1911be7 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -165,10 +165,11 @@
                                 string keyVlaue = "set_temp";
                                 string set_temp_value = temperature.Replace("鈩�", "");
                                 LogicMethod.dictionary(dic, "value", set_temp_value);
-                                selectedState = device.functionType + "_set_temp";
                                 AddDictionaryData(dicSateteList, keyVlaue, dic);
+                                selectedState = device.functionType + "_set_temp";
                                 RemView(frame);
                                 temperatureView.btnState.Text = temperature;
+
 
                             };
                         };
@@ -741,61 +742,31 @@
             };
             this.AddChidren(frame);
             LogicView.SwitchView switchView = new LogicView.SwitchView();
-            switchView.FLayoutView(frame, len);
+            switchView.FLayoutView(frame, len, button.Text, (strValue) =>
+            {
+                int id = 0;
+                switch (strValue) {
+                    case "on": {
+                            id = StringId.onLogic;
+                        }
+                        break;
+                    case "off": {
+                            id = StringId.offLogic;
+                        } break;
+                    case "stop": {
+                            id = StringId.stop;
+                        } break;
+                }
+                button.TextID = id;
+                Dictionary<string, string> dic = new Dictionary<string, string>();
+                LogicMethod.dictionary(dic, "key", "on_off");
+                string keyVlaue = "on_off";
+                LogicMethod.dictionary(dic, "value", strValue);
+                AddDictionaryData(dicSateteList, keyVlaue, dic);
+                selectedState = device.functionType + "_" + strValue;
+
+            });
             #endregion
-
-            #region 鐐瑰嚮浜嬩欢
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            LogicMethod.dictionary(dic, "key", "on_off");
-            string keyVlaue = "on_off";
-            //寮�-鐐瑰嚮浜嬩欢
-            switchView.btnOn.MouseUpEventHandler += (sender2, e2) =>
-            {
-                LogicMethod.dictionary(dic, "value", "on");
-                button.TextID = StringId.onLogic;
-                selectedState = device.functionType + "_on";
-                AddDictionaryData(dicSateteList, keyVlaue, dic);
-                RemView(frame);
-            };
-            //鍏�-鐐瑰嚮浜嬩欢
-            switchView.btnOff.MouseUpEventHandler += (sender3, e3) =>
-            {
-                LogicMethod.dictionary(dic, "value", "off");
-                button.TextID = StringId.offLogic;
-                selectedState = device.functionType + "_off";
-                AddDictionaryData(dicSateteList, keyVlaue, dic);
-                RemView(frame);
-
-            };
-            //鏆傚仠-鐐瑰嚮浜嬩欢
-            switchView.btnStop.MouseUpEventHandler += (sender3, e3) =>
-            {
-                LogicMethod.dictionary(dic, "value", "stop");
-                button.TextID = StringId.stop;
-                selectedState = device.functionType + "_stop";
-                AddDictionaryData(dicSateteList, keyVlaue, dic);
-                RemView(frame);
-
-            };
-            ///鏄剧ず涔嬪墠鐘舵��
-            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;
-                }
-                else if (button.Text == switchView.btnStop.Text)
-                {
-                    switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor;
-                }
-            }
-            #endregion
-
-
         }
         /// <summary>
         /// 浜害/鐧惧垎姣�=鍔熻兘涓嬩竴绾х晫闈�
@@ -811,85 +782,36 @@
             };
             this.AddChidren(frame);
             LogicView.BrightnessView brightness = new LogicView.BrightnessView();
-            brightness.btnTitle.Text = titleName;
-            brightness.FLayoutView(frame);
-            #endregion
-            #region 鐐瑰嚮浜嬩欢
-            int brightnesValue = 0;
-            Dictionary<string, string> dic = new Dictionary<string, string>();
-            string keyVlaue = "";
-
-            switch (device.functionType)
+            brightness.FLayoutView(frame, titleName, button.Text, (brightnesValue) =>
             {
-                //寮�鍏崇伅鍏� light.Switch
-                case FunctionType.Dimmer:
-                case FunctionType.RGB:
-                case FunctionType.RGBW:
-                case FunctionType.ColorTemperature:
-                    {
-                        LogicMethod.dictionary(dic, "key", "brightness");
-                        keyVlaue = "brightness";
-                    }
-                    break;
-               
-                case FunctionType.MotorCurtain:
-                case FunctionType.RollingShutter:
-                    {
-                        LogicMethod.dictionary(dic, "key", "percent");
-                        keyVlaue = "percent";
-                    }
-                    break;
-            }
-            
-            //鈥旂偣鍑讳簨浠�
-            brightness.btn_subtract_click.MouseUpEventHandler += (sender2, e2) =>
-            {
-                if (brightnesValue > 0)
+                button.Text = brightnesValue;
+                Dictionary<string, string> dic = new Dictionary<string, string>();
+                string keyVlaue = "";
+                switch (device.functionType)
                 {
-                    brightnesValue -= 1;
-                    brightness.seekBarVol.Progress = brightnesValue;
+                    //寮�鍏崇伅鍏� light.Switch
+                    case FunctionType.Dimmer:
+                    case FunctionType.RGB:
+                    case FunctionType.RGBW:
+                    case FunctionType.ColorTemperature:
+                        {
+                            LogicMethod.dictionary(dic, "key", "brightness");
+                            keyVlaue = "brightness";
+                        }
+                        break;
+                    case FunctionType.MotorCurtain:
+                    case FunctionType.RollingShutter:
+                        {
+                            LogicMethod.dictionary(dic, "key", "percent");
+                            keyVlaue = "percent";
+                        }
+                        break;
                 }
-            };
-            //+鐐瑰嚮浜嬩欢
-            brightness.btn_add_click.MouseUpEventHandler += (sende2, e2) =>
-            {
-                if (brightnesValue < 100)
-                {
-                    brightnesValue += 1;
-                    brightness.seekBarVol.Progress = brightnesValue;
-
-                }
-            };
-            //杩涘害鏉℃粦鍔ㄧ偣鍑讳簨浠�
-            EventHandler<int> progressclick = (sender2, e2) =>
-            {
-                brightnesValue = brightness.seekBarVol.Progress;
-            };
-            brightness.seekBarVol.OnProgressChangedEvent += progressclick;
-            brightness.seekBarVol.OnStopTrackingTouchEvent += progressclick;
-            //纭畾鐐瑰嚮浜嬩欢
-            brightness.btnConfirm.MouseUpEventHandler += (sende2, e2) =>
-            {
-                if (brightnesValue == 0)
-                {
-                    return;
-                }
-
                 LogicMethod.dictionary(dic, "value", brightnesValue.ToString());
-                selectedState = device.functionType + brightnesValue.ToString();
                 AddDictionaryData(dicSateteList, keyVlaue, dic);
-                button.Text = brightnesValue.ToString();
-                RemView(frame);
-
-            };
-            //鏄剧ず涔嬪墠鐘舵��
-            if (button.Text != "")
-            {
-                brightnesValue = int.Parse(button.Text);
-                brightness.seekBarVol.Progress = brightnesValue;
-            }
+                selectedState = device.functionType + brightnesValue.ToString();
+            });
             #endregion
-
 
         }
         /// <summary>

--
Gitblit v1.8.0