From f8bafd162ad7adf2f21986389568d650b71f976b Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 08 三月 2022 17:20:12 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/wjc' into release0123

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs        |    9 -
 HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs             |    3 
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs         |  177 ++++++++++++++++++++++-------------
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs |   19 ++-
 HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs |   60 +++++++++++
 5 files changed, 181 insertions(+), 87 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
index 845f1de..deee2f7 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
@@ -9,14 +9,7 @@
         {
             Tag = "Logic";
         }
-        /// <summary>
-        /// 榛樿閫変腑鏄埧闂存椂锛氬叏閮ㄥ尯鍩�
-        /// </summary>
-        private Entity.Room selectedRoom = new Entity.Room { roomId = "6688" };
-        /// <summary>
-        /// 琛ㄧず鏄�(鏉′欢/鐩爣)
-        /// </summary>
-        private string if_type = LogicMethod.condition_if;
+       
         public void Show()
         {
             LogicView.TopView topView = new LogicView.TopView();
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
index 2eeecfc..8cc3709 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
@@ -5,11 +5,10 @@
 
 namespace HDL_ON.UI.UI2.Intelligence.Automation
 {
-    public class FunTpye : FrameLayout
+    public class FunTpye
     {
         public FunTpye(string str)
         {
-            Tag = "Logic";
             if_type = str;
         }
         /// <summary>
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index e6fc71d..b9c6f17 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -939,6 +939,7 @@
                             targetView.btnText.Text = device.name;
                             //鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害
                             targetView.btnText.Width = Application.GetRealWidth(80);
+                            targetView.btnDelay.Visible = false;
                             //鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬�
                             switch (device.spk)
                             {
@@ -1361,7 +1362,7 @@
                 {
 
                     InpOrOutLogicMethod inpOrOutLogicMethod = new InpOrOutLogicMethod();
-                    inpOrOutLogicMethod.Delayed(thisView, outputTarget, (value) =>
+                    inpOrOutLogicMethod.Delayed(thisView, outputTarget.delay, (value) =>
                     {
                         outputTarget.delay = value.ToString();
                         if (outputTarget.target_type == "1")
@@ -2092,10 +2093,10 @@
         /// <summary>
         /// 寤舵椂鏃堕棿鏂规硶
         /// </summary>
-        /// <param name="fLayout">鍦ㄥ摢涓晫闈㈡樉绀�</param>
-        /// <param name="edit">锛坱rue=缂栬緫锛沠alse=鏂板缓锛�</param>
-        /// <param name="index">缂栬緫鏉′欢鐨勭储寮�</param>
-        private void Delayed(FrameLayout thisFLayout, Output output, Action<int> action)
+        /// <param name="thisFLayout">鍦ㄥ摢涓晫闈㈡樉绀�</param>
+        /// <param name="delay">褰撳墠寤舵椂鏃堕棿</param>
+        /// <param name="action">鍥炶皟鍑芥暟</param>
+        public void Delayed(FrameLayout thisFLayout, string delay, Action<int> action)
         {
             FrameLayout fLayout = new FrameLayout
             {
@@ -2119,9 +2120,9 @@
             //瀹氫箟涓�涓眬閮ㄥ彉閲忚褰曢�変腑鏃堕棿
             int timepoint = 5;
 
-            if (output.delay != "0")
+            if (delay != "0")
             {
-                int intValue = int.Parse(output.delay);
+                int intValue = int.Parse(delay);
                 var m = intValue / 60;
                 var s = intValue % 60;
 
@@ -2137,8 +2138,8 @@
             //閫変腑鏃堕棿鍥炶皟鏂规硶,鏃堕棿鍙樺寲涓�娆″洖璋冧竴娆�
             timePointView.mUIPickerView.OnSelectChangeEvent += (index1, index2, index3) =>
             {
-                string minuet = timePointView.GethStringList0()[index1].Split(' ')[0];
-                string second = timePointView.GetmStringList()[index2].Split(' ')[0];
+                string minuet = timePointView.GetmStringList()[index1].Split(' ')[0];
+                string second = timePointView.GetsStringList()[index2].Split(' ')[0];
                 int minuetIntValue = int.Parse(minuet);
                 int secondIntValue = int.Parse(second);
                 timepoint = minuetIntValue * 60 + secondIntValue;
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index 4d222e3..bd6a462 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -494,74 +494,119 @@
     public List<string> GetDeviceTypeFunctionList(string deviceType)
     {
       List<string> functionTypeList = new List<string>();
-      ///鐏厜绫�
-      if (deviceType == Language.StringByID(StringId.Lights))
-      {
-        functionTypeList.Add(SPK.LightSwitch);
-        functionTypeList.Add(SPK.LightDimming);
-        functionTypeList.Add(SPK.LightRGB);
-        functionTypeList.Add(SPK.LightRGBW);
-        functionTypeList.Add(SPK.LightCCT);
-        functionTypeList.Add(SPK.AirSwitch);
-        functionTypeList.Add(SPK.PanelSocket);
-        functionTypeList.Add(SPK.ElectricSocket);
-      }
-      ///绐楀笜绫�
-      else if (deviceType == Language.StringByID(StringId.Curtain))
-      {
-        functionTypeList.Add(SPK.CurtainSwitch);
-        functionTypeList.Add(SPK.CurtainRoller);
-        functionTypeList.Add(SPK.CurtainTrietex);
-      }
-      ///绌鸿皟绫�
-      else if (deviceType == Language.StringByID(StringId.AC))
-      {
-        functionTypeList.Add(SPK.AcStandard);
-        functionTypeList.Add(SPK.HvacAC);
-      }
-      ///鍦版殩绫�
-      else if (deviceType == Language.StringByID(StringId.FloorHeating))
-      {
-        functionTypeList.Add(SPK.FloorHeatStandard); functionTypeList.Add(SPK.HvacFloorHeat);
-      }
-      ///鏂伴绫�
-      else if (deviceType == Language.StringByID(StringId.AirFresh))
-      {
-        functionTypeList.Add(SPK.AirFreshStandard); functionTypeList.Add(SPK.HvacAirFresh);
-      }
-      ///浼犳劅鍣ㄧ被
-      else if (deviceType == Language.StringByID(StringId.Sensor))
-      {
-        functionTypeList.Add(SPK.SensorSmoke);
-        functionTypeList.Add(SPK.SensorWater);
-        functionTypeList.Add(SPK.SensorGas);
-        functionTypeList.Add(SPK.SensorDryContact); functionTypeList.Add(SPK.SensorDryContact2);
-        functionTypeList.Add(SPK.SensorShanLan);
-        functionTypeList.Add(SPK.SensorDuiShe);
-        functionTypeList.Add(SPK.SensorPir);
-        functionTypeList.Add(SPK.SensorDoorWindow);
-        functionTypeList.Add(SPK.SensorUtrasonic);
-        functionTypeList.Add(SPK.SenesorMegahealth);
-        functionTypeList.Add(SPK.SenesorMegahealth2);
-        functionTypeList.Add(SPK.SensorEnvironment);
-        functionTypeList.Add(SPK.SensorEnvironment2);
-        functionTypeList.Add(SPK.SensorEnvironment3);
-        functionTypeList.Add(SPK.SensorTemperature);
-        functionTypeList.Add(SPK.SensorHumidity);
-        functionTypeList.Add(SPK.SensorCO2);
-        functionTypeList.Add(SPK.SensorPm25);
-        functionTypeList.Add(SPK.SensorTVOC);
-        functionTypeList.Add(SPK.SensorHcho);
+            ///鐏厜绫�
+            if (deviceType == Language.StringByID(StringId.Lights))
+            {
+                functionTypeList.Add(SPK.LightSwitch);
+                functionTypeList.Add(SPK.LightDimming);
+                functionTypeList.Add(SPK.LightRGB);
+                functionTypeList.Add(SPK.LightRGBW);
+                functionTypeList.Add(SPK.LightCCT);
+                functionTypeList.Add(SPK.AirSwitch);
+                functionTypeList.Add(SPK.PanelSocket);
+                functionTypeList.Add(SPK.ElectricSocket);
+            }
+            ///绐楀笜绫�
+            else if (deviceType == Language.StringByID(StringId.Curtain))
+            {
+                functionTypeList.Add(SPK.CurtainSwitch);
+                functionTypeList.Add(SPK.CurtainRoller);
+                functionTypeList.Add(SPK.CurtainTrietex);
+            }
+            ///绌鸿皟绫�
+            else if (deviceType == Language.StringByID(StringId.AC))
+            {
+                functionTypeList.Add(SPK.AcStandard);
+                functionTypeList.Add(SPK.HvacAC);
+            }
+            ///鍦版殩绫�
+            else if (deviceType == Language.StringByID(StringId.FloorHeating))
+            {
+                functionTypeList.Add(SPK.FloorHeatStandard); functionTypeList.Add(SPK.HvacFloorHeat);
+            }
+            ///鏂伴绫�
+            else if (deviceType == Language.StringByID(StringId.AirFresh))
+            {
+                functionTypeList.Add(SPK.AirFreshStandard); functionTypeList.Add(SPK.HvacAirFresh);
+            }
+            ///浼犳劅鍣ㄧ被
+            else if (deviceType == Language.StringByID(StringId.Sensor))
+            {
+                functionTypeList.Add(SPK.SensorSmoke);
+                functionTypeList.Add(SPK.SensorWater);
+                functionTypeList.Add(SPK.SensorGas);
+                functionTypeList.Add(SPK.SensorDryContact); functionTypeList.Add(SPK.SensorDryContact2);
+                functionTypeList.Add(SPK.SensorShanLan);
+                functionTypeList.Add(SPK.SensorDuiShe);
+                functionTypeList.Add(SPK.SensorPir);
+                functionTypeList.Add(SPK.SensorDoorWindow);
+                functionTypeList.Add(SPK.SensorUtrasonic);
+                functionTypeList.Add(SPK.SenesorMegahealth);
+                functionTypeList.Add(SPK.SenesorMegahealth2);
+                functionTypeList.Add(SPK.SensorEnvironment);
+                functionTypeList.Add(SPK.SensorEnvironment2);
+                functionTypeList.Add(SPK.SensorEnvironment3);
+                functionTypeList.Add(SPK.SensorTemperature);
+                functionTypeList.Add(SPK.SensorHumidity);
+                functionTypeList.Add(SPK.SensorCO2);
+                functionTypeList.Add(SPK.SensorPm25);
+                functionTypeList.Add(SPK.SensorTVOC);
+                functionTypeList.Add(SPK.SensorHcho);
 
 
-      }
-      ///瀹剁數绫�
-      else if (deviceType == Language.StringByID(StringId.Electric))
-      {
-        functionTypeList.Add(SPK.AirSwitch);
-        functionTypeList.Add(SPK.PanelSocket);
-        functionTypeList.Add(SPK.ElectricSocket);
-      }
+            }
+            ///瀹剁數绫�
+            else if (deviceType == Language.StringByID(StringId.Electric))
+            {
+                functionTypeList.Add(SPK.AirSwitch);
+                functionTypeList.Add(SPK.PanelSocket);
+                functionTypeList.Add(SPK.ElectricSocket);
+            }
+            else {
+                functionTypeList.Add(SPK.LightSwitch);
+                functionTypeList.Add(SPK.LightDimming);
+                functionTypeList.Add(SPK.LightRGB);
+                functionTypeList.Add(SPK.LightRGBW);
+                functionTypeList.Add(SPK.LightCCT);
+                functionTypeList.Add(SPK.AirSwitch);
+                functionTypeList.Add(SPK.PanelSocket);
+                functionTypeList.Add(SPK.ElectricSocket);
+                functionTypeList.Add(SPK.CurtainSwitch);
+                functionTypeList.Add(SPK.CurtainRoller);
+                functionTypeList.Add(SPK.CurtainTrietex);
+                functionTypeList.Add(SPK.AcStandard);
+                functionTypeList.Add(SPK.HvacAC);
+                functionTypeList.Add(SPK.FloorHeatStandard);
+                functionTypeList.Add(SPK.HvacFloorHeat);
+                functionTypeList.Add(SPK.AirFreshStandard);
+                functionTypeList.Add(SPK.HvacAirFresh);
+                functionTypeList.Add(SPK.SensorSmoke);
+                functionTypeList.Add(SPK.SensorWater);
+                functionTypeList.Add(SPK.SensorGas);
+                functionTypeList.Add(SPK.SensorDryContact);
+                functionTypeList.Add(SPK.SensorDryContact2);
+                functionTypeList.Add(SPK.SensorShanLan);
+                functionTypeList.Add(SPK.SensorDuiShe);
+                functionTypeList.Add(SPK.SensorPir);
+                functionTypeList.Add(SPK.SensorDoorWindow);
+                functionTypeList.Add(SPK.SensorUtrasonic);
+                functionTypeList.Add(SPK.SenesorMegahealth);
+                functionTypeList.Add(SPK.SenesorMegahealth2);
+                functionTypeList.Add(SPK.SensorEnvironment);
+                functionTypeList.Add(SPK.SensorEnvironment2);
+                functionTypeList.Add(SPK.SensorEnvironment3);
+                functionTypeList.Add(SPK.SensorTemperature);
+                functionTypeList.Add(SPK.SensorHumidity);
+                functionTypeList.Add(SPK.SensorCO2);
+                functionTypeList.Add(SPK.SensorPm25);
+                functionTypeList.Add(SPK.SensorTVOC);
+                functionTypeList.Add(SPK.SensorHcho);
+                functionTypeList.Add(SPK.AirSwitch);
+                functionTypeList.Add(SPK.PanelSocket);
+                functionTypeList.Add(SPK.ElectricSocket);
+
+
+            }
 
 
       return functionTypeList;
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
index 4e8a634..9866147 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -12,6 +12,14 @@
             Tag = "Logic";
         }
         /// <summary>
+        /// 璁惧寤舵椂鏃堕棿
+        /// </summary>
+        private string strdelay = "0";
+        /// <summary>
+        /// 鏄剧ず璁惧寤舵椂鏃堕棿
+        /// </summary>
+        private Button btnDelay =null;
+        /// <summary>
         /// 瀹氫箟涓�涓褰曢�変腑璁惧鐘舵�佸垪琛紱
         /// </summary>
         private List<Dictionary<string, string>> dicSateteList = new List<Dictionary<string, string>>();
@@ -59,6 +67,9 @@
                         LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView();
                         lightSwitchView.btnText.TextID = StringId.switchLogic;
                         fLayout.AddChidren(lightSwitchView.FLayoutView());
+
+                        ///璁惧寤舵椂iewv
+                        DelayView(fLayout, lightSwitchView.frameLayout.Bottom);
                         #endregion
                         #region 鐐瑰嚮浜嬩欢
                         ///寮�鍏崇偣鍑讳簨浠�
@@ -91,6 +102,8 @@
                         brightnessView.btnText.TextID = StringId.brightnesLogic;
                         fLayout.AddChidren(brightnessView.FLayoutView());
                         brightnessView.btnState.Text = "5%";//浜у搧缁忕悊鏅撹緣瑕佹眰鏀圭殑 2021-11-06
+                        ///璁惧寤舵椂iewv
+                        DelayView(fLayout, brightnessView.frameLayout.Bottom);
                         #endregion
                         #region 鐐瑰嚮浜嬩欢
                         ///寮�鍏崇偣鍑讳簨浠�
@@ -122,6 +135,8 @@
                         LogicView.FunTypeView curtainSwitchView = new LogicView.FunTypeView();
                         curtainSwitchView.btnText.TextID = StringId.switchLogic;
                         fLayout.AddChidren(curtainSwitchView.FLayoutView());
+                        ///璁惧寤舵椂iewv
+                        DelayView(fLayout, curtainSwitchView.frameLayout.Bottom);
                         #endregion
                         #region 鐐瑰嚮浜嬩欢
                         ///寮�鍏崇偣鍑讳簨浠�
@@ -163,6 +178,8 @@
                         acSpeedView.frameLayout.Y = acModehView.frameLayout.Bottom;
                         acSpeedView.btnText.TextID = StringId.speedLogic;
                         fLayout.AddChidren(acSpeedView.FLayoutView());
+                        ///璁惧寤舵椂iewv
+                        DelayView(fLayout, acModehView.frameLayout.Bottom);
                         #endregion
                         #region 鐐瑰嚮浜嬩欢
                         ///寮�鍏崇偣鍑讳簨浠�
@@ -260,7 +277,8 @@
                         floorHeatingModehView.btnText.TextID = StringId.modeLogic;
                         fLayout.AddChidren(floorHeatingModehView.FLayoutView());
 
-
+                        ///璁惧寤舵椂iewv
+                        DelayView(fLayout, floorHeatingModehView.frameLayout.Bottom);
                         #endregion
                         #region 鐐瑰嚮浜嬩欢
                         ///寮�鍏崇偣鍑讳簨浠�
@@ -333,6 +351,9 @@
                         AirFreshSpeedView.frameLayout.Y = AirFreshSwitchVie.frameLayout.Bottom;
                         AirFreshSpeedView.btnText.TextID = StringId.speedLogic;
                         fLayout.AddChidren(AirFreshSpeedView.FLayoutView());
+
+                        ///璁惧寤舵椂iewv
+                        DelayView(fLayout, AirFreshSpeedView.frameLayout.Bottom);
                         #endregion
                         #region 鐐瑰嚮浜嬩欢
                         ///寮�鍏崇偣鍑讳簨浠�
@@ -413,6 +434,7 @@
                     Output outputDevice = new Output();
                     outputDevice.target_type = "1";
                     outputDevice.sid = device.sid;
+                    outputDevice.delay= strdelay;
                     switch (device.spk)
                     {
                         case SPK.LightDimming:
@@ -477,7 +499,7 @@
                     if (edit)
                     {
                         //鏇存柊寤舵椂鏃堕棿
-                        outputDevice.delay = Logic.currlogic.output[index].delay;
+                        outputDevice.delay = strdelay;//Logic.currlogic.output[index].delay;
                         //绉婚櫎鏃ф暟鎹�
                         Logic.currlogic.output.RemoveAt(index);
                         //鏂版暟鎹彃鍏ユ棫鏁版嵁鐨勪綅缃�;
@@ -508,6 +530,34 @@
             #endregion
 
         }
+        /// <summary>
+        /// 寤舵椂View
+        /// </summary>
+        /// <param name="fLayout">鐖舵帶浠�</param>
+        /// <param name="bottomY">鍦ㄥ摢涓帶浠朵笅闈�</param>
+        private void DelayView(FrameLayout fLayout, int bottomY)
+        {
+            LogicView.FunTypeView delayView = new LogicView.FunTypeView();
+            delayView.frameLayout.Y = bottomY;
+            delayView.btnText.TextID = StringId.Delay;
+            delayView.btnState.Text = strdelay + "s";
+            fLayout.AddChidren(delayView.FLayoutView());
+            ///璧嬪�煎璞�
+            this.btnDelay = delayView.btnState;
+            ///寤舵椂鐐瑰嚮浜嬩欢
+            delayView.btnClick.MouseUpEventHandler += (sender, e) =>
+            {
+                InpOrOutLogicMethod inpOrOutLogicMethod = new InpOrOutLogicMethod();
+                inpOrOutLogicMethod.Delayed(this, strdelay, (value) =>
+                {
+                    selectedState = "delay_" + strdelay;
+                    strdelay = value.ToString();
+                    delayView.btnState.Text = strdelay + "s";
+                });
+            };
+
+        }
+
         /// <summary>
         /// 寮�鍏�=鍔熻兘涓嬩竴绾х晫闈�
         /// </summary>
@@ -613,6 +663,12 @@
                 //鏈夋暟鎹噸鏂拌祴鍊�
                 dicSateteList = dicList;
             }
+            if (this.btnDelay != null)
+            {
+                ///寤舵椂鏄剧ず鏂囨湰
+                this.btnDelay.Text = outputs.delay + "s";
+                this.strdelay = outputs.delay;
+            }
             InpOrOutLogicMethod.EditState(device, dicList, button1, button2, button3, button4);
         }
         /// <summary>

--
Gitblit v1.8.0