From d987694e57c3bce76bd5a208d74a3696db222a4a Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 14 一月 2021 14:00:06 +0800
Subject: [PATCH] Merge branch 'WJC' into NewFilePath

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs |   88 ++++++++++++++++++++++++++++++++------------
 1 files changed, 64 insertions(+), 24 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
index c14acb6..c073d7f 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
@@ -34,7 +34,7 @@
             };
             //鑾峰彇鑷姩鍖栧垪琛�
             GetLogicList();
-             for (int i = Logic.LogicList.Count-1; i >= 0; i--)//闄嶅簭鎺掑垪
+            for (int i = Logic.LogicList.Count - 1; i >= 0; i--)//闄嶅簭鎺掑垪
             //for (int i = 0; i < Logic.LogicList.Count; i++)
             {
                 var currLogic = Logic.LogicList[i];
@@ -76,12 +76,12 @@
 
                         }
                         catch { }
-                       
+
                     })
                     { IsBackground = true }.Start();
                 };
                 GetSelectIcon(logicView.frameLayout, currLogic);
-                if (i==0)//闄嶅簭鎺掑垪
+                if (i == 0)//闄嶅簭鎺掑垪
                 //if (Logic.LogicList.Count - 1 == i)
                 {
                     ///鏈�鍚庝竴涓窛绂绘渶搴曢儴12,鐣岄潰鏄剧ず鏁堟灉浣滅敤;
@@ -135,7 +135,7 @@
         ///杩斿洖寰幆鎻忚堪鏂囨湰
         /// </summary>
         /// <param name="logic"></param>
-        public static string GetCyclicText(Logic logic) 
+        public static string GetCyclicText(Logic logic)
         {
 
             string weekName = "";
@@ -269,8 +269,38 @@
                         var if_logic = Logic.LogicList.Find((c) => c.userLogicId == logic.userLogicId);
                         if (if_logic == null)
                         {
+
+                            Logic newlogic = new Logic();
+                            newlogic.name = logic.name;
+                            newlogic.userLogicId = logic.userLogicId;
+                            newlogic.sid = logic.sid;
+                            newlogic.relation = logic.relation;
+                            newlogic.enable = logic.enable;
+                            newlogic.cycle = logic.cycle;
+                            for (int i = 0; i < logic.input.Count; i++)
+                            {
+                                if (logic.input[i] == null || string.IsNullOrEmpty(logic.input[i].condition_type))
+                                {
+                                    //闃叉璋冭瘯杞欢涔变紶涓滆タ涓婃潵;
+                                    //闃叉鏈夌┖瀵硅薄锛�
+                                    //姝e父鎯呭喌涓嬩笉浼氬嚭鐜扮殑鐜拌薄锛�
+                                    continue;
+                                }
+                                newlogic.input.Add(logic.input[i]);
+                            }
+                            for (int i = 0; i < logic.output.Count; i++)
+                            {
+                                if (logic.output[i] == null || string.IsNullOrEmpty(logic.output[i].target_type))
+                                {
+                                    //闃叉璋冭瘯杞欢涔变紶涓滆タ涓婃潵;
+                                    //闃叉鏈夌┖瀵硅薄锛�
+                                    //姝e父鎯呭喌涓嬩笉浼氳鐜拌薄锛�
+                                    continue;
+                                }
+                                newlogic.output.Add(logic.output[i]);
+                            }
                             //娣诲姞閫昏緫
-                            Logic.LogicList.Add(logic);
+                            Logic.LogicList.Add(newlogic);
                         }
                     }
 
@@ -353,12 +383,6 @@
             //14-寤舵椂鍥炬爣
             for (int i = 0; i < logic.output.Count; i++)
             {
-                if (logic.output[i] == null)
-                {
-                    //闃叉鏈夌殑绌哄璞★紱
-                    //姝e父鎯呭喌涓嬩笉浼氳鐜拌薄锛�
-                    continue;
-                }
                 var int1 = int.Parse(logic.output[i].target_type);
                 int iconInt = 0;
                 switch (int1)
@@ -389,10 +413,11 @@
                 }
             }
             //鍥炬爣鎺т欢鐨勭埗鎺т欢
-            FrameLayout frame = new FrameLayout {
-                Height=Application.GetRealHeight(40),
-                Width=Application.GetRealWidth(275),
-                Y= Application.GetRealHeight(56),
+            FrameLayout frame = new FrameLayout
+            {
+                Height = Application.GetRealHeight(40),
+                Width = Application.GetRealWidth(275),
+                Y = Application.GetRealHeight(56),
             };
             layouFrame.AddChidren(frame);
 
@@ -404,7 +429,7 @@
                 {
                     Width = Application.GetRealWidth(28),
                     Height = Application.GetRealWidth(28),
-                    Gravity=Gravity.CenterVertical,
+                    Gravity = Gravity.CenterVertical,
                 };
                 frame.AddChidren(btnIcon);
 
@@ -414,12 +439,14 @@
                 }
                 else
                 {
-                    btnIcon.X = Application.GetRealWidth(12+(28+4)*i);
+                    btnIcon.X = Application.GetRealWidth(12 + (28 + 4) * i);
                 }
                 string strIcon = "";
-                switch (iconIntValue[i]) {
-                  
-                    case 1: {
+                switch (iconIntValue[i])
+                {
+
+                    case 1:
+                        {
                             strIcon = "LogicIcon/selectTheTime.png";
                         }
                         break;
@@ -433,17 +460,21 @@
                         {
                             //鍒嗗壊鏉′欢鍜岀洰鏍囩殑鍥炬爣
                             strIcon = "LogicIcon/link.png";
-                        } break;
+                        }
+                        break;
                     case 12:
                         {
 
                             strIcon = "LogicIcon/selectTheFun.png";
                         }
                         break;
-                    case 13: {
+                    case 13:
+                        {
                             strIcon = "LogicIcon/selectTheScene.png";
-                        } break;
-                    case 14: {
+                        }
+                        break;
+                    case 14:
+                        {
                             //strIcon = "LogicIcon/timeicon.png";
                         }
                         break;
@@ -459,12 +490,21 @@
         /// 浜戠鍞竴id
         /// </summary>
         public string userLogicId = "";
+        /// <summary>
+        /// 缃戝叧id
+        /// </summary>
         public string gatewayId = "";
         /// <summary>
         /// 閫昏緫鍞竴鏍囪瘑
         /// </summary>
         public string sid = "";
+        /// <summary>
+        /// 閫昏緫鍚嶇О
+        /// </summary>
         public string name = "";
+        /// <summary>
+        /// 閫昏緫浣胯兘锛堝紑锛屽叧锛�
+        /// </summary>
         public string enable = "";
         //public CycleA cycle;
         //public string modifyTime = "";

--
Gitblit v1.8.0