From c3713f82e0f23ff8c5077056c3192d9de554bd2b Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期一, 23 八月 2021 09:59:08 +0800
Subject: [PATCH] 2021-8-23-01

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs     |    8 ++
 HDL-ON_iOS/Resources/Language.ini                              |    4 +
 HDL-ON_Android/Assets/Language.ini                             |    7 +
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs |   22 ++++-
 HDL_ON/Common/R.cs                                             |   10 ++
 HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs           |    7 +
 HDL_ON/UI/UI2/3-Intelligence/Automation/Security.cs            |  146 ++++++++++++++++++++++++++++++++++++
 7 files changed, 196 insertions(+), 8 deletions(-)

diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini
index b23332d..b5e988c 100644
--- a/HDL-ON_Android/Assets/Language.ini
+++ b/HDL-ON_Android/Assets/Language.ini
@@ -978,7 +978,9 @@
 7144=excellence
 7145=Security
 7146=Add security
-7146=娣诲姞瀹夐槻
+7147=Arm
+7148=Disarm
+
     
 9000=Please sign in with new cell phone number.
 9001=Please sign in with new email address.
@@ -2046,6 +2048,9 @@
 7143=鍋忛珮
 7144=浼樼
 7145=瀹夐槻
+7146=娣诲姞瀹夐槻
+7147=甯冮槻
+7148=鎾ら槻
  
 9000=璇蜂娇鐢ㄦ柊鐨勬墜鏈鸿处鍙风櫥褰旳PP
 9001=璇蜂娇鐢ㄦ柊鐨勯偖绠辫处鍙风櫥褰旳PP
diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini
index c52cafd..d9c9a43 100644
--- a/HDL-ON_iOS/Resources/Language.ini
+++ b/HDL-ON_iOS/Resources/Language.ini
@@ -991,6 +991,8 @@
 7144=excellence
 7145=Security
 7146=Add security
+7147=Arm
+7148=Disarm
 
 
     
@@ -2073,6 +2075,8 @@
 7144=浼樼
 7145=瀹夐槻
 7146=娣诲姞瀹夐槻
+7147=甯冮槻
+7148=鎾ら槻
 
  
 9000=璇蜂娇鐢ㄦ柊鐨勬墜鏈鸿处鍙风櫥褰旳PP
diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs
index 7169226..97598d7 100644
--- a/HDL_ON/Common/R.cs
+++ b/HDL_ON/Common/R.cs
@@ -2541,7 +2541,15 @@
         /// <summary>
         /// 娣诲姞瀹夐槻
         /// </summary>
-        public const int addSecurityLogic = 7046;
+        public const int addSecurityLogic = 7146;
+        /// <summary>
+        /// 甯冮槻
+        /// </summary>
+        public const int bufang = 7147;
+        /// <summary>
+        /// 鎾ら槻
+        /// </summary>
+        public const int chefang = 7148;
 
 
         #region LE鏂板
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
index 31845a4..ba94b4d 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
@@ -75,7 +75,12 @@
             //瀹夐槻鐐瑰嚮浜嬩欢
             securityView.btnClick.MouseUpEventHandler += (sen, e) =>
             {
-                SecurityMethod(this);
+                Security security = new Security();
+                MainPage.BasePageView.AddChidren(security);
+                security.Show();
+                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+
+                //SecurityMethod(this);
             };
             //寤舵椂鐐瑰嚮浜嬩欢
             delayView.btnClick.MouseUpEventHandler += (sen, e) =>
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index 22c90d5..8091f6f 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -1103,8 +1103,20 @@
                             //鐢╯id鎵惧埌瀹夐槻锛�
                             var security = LogicMethod.CurrLogicMethod.GetSecurity(outputTarget.sid);
                             targetView.btnIcon.UnSelectedImagePath = "LogicIcon/security.png";
+                            targetView.btnDelay.Visible = false;
                             //鏄剧ず瀹夐槻鍚嶇О 
-                            stateStr = security.name;
+                            targetView.btnText.Text = security.name;
+                            string value = GetKeyValue("security", dicList);
+                            if (value == "enable")
+                            {
+                                stateStr = Language.StringByID(StringId.bufang);
+
+                            }
+                            else
+                            {
+                                stateStr = Language.StringByID(StringId.chefang);
+                            }
+
                         }
                         break;
                     case "4":
@@ -1119,9 +1131,9 @@
                         break;
                 }
 
-                if (outputTarget.target_type == "1")
+                if (outputTarget.target_type == "1" || outputTarget.target_type == "3")
                 {
-                    targetView.btnState.Text =new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr;
+                    targetView.btnState.Text = new InpOrOutLogicMethod { }.GetTimeText(outputTarget.delay) + stateStr;
                 }
                 else
                 {
@@ -1160,8 +1172,8 @@
                             break;
                         case "3":
                             {
-                                AddTarget addTarget = new AddTarget();
-                                addTarget.SecurityMethod(thisView, edit, indexVulae);
+                                Security security = new Security();
+                                security.SecurityMethod(thisView, "", edit, indexVulae);
                             }
                             break;
                         case "4":
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
index 92fc099..14b652c 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -709,6 +709,14 @@
                       };
                     }
                     break;
+                case "security":
+                    {
+                        list = new List<string> {
+             Language.StringByID(StringId.bufang ),
+             Language.StringByID(StringId.chefang),
+                      };
+                    }
+                    break;
 
             }
             return list;
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Security.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Security.cs
new file mode 100644
index 0000000..c6caebb
--- /dev/null
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Security.cs
@@ -0,0 +1,146 @@
+锘縰sing System;
+using System.Collections.Generic;
+using Shared;
+namespace HDL_ON.UI.UI2.Intelligence.Automation
+{
+    public class Security : FrameLayout
+    {
+        public Security()
+        {
+            Tag = "Logic";
+        }
+        public void Show()
+        {
+
+            LogicView.TopView topView = new LogicView.TopView();
+            this.AddChidren(topView.FLayoutView());
+            topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
+            {
+                RemoveFromParent();
+            };
+            topView.topNameBtn.TextID = StringId.addSecurityLogic;
+
+            VerticalScrolViewLayout viewLayout = new VerticalScrolViewLayout
+            {
+                Y = Application.GetRealHeight(64),
+                Width = Application.GetRealWidth(LogicView.TextSize.view375),
+                Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64),
+                BackgroundColor = CSS.CSS_Color.viewMiddle,
+            };
+            this.AddChidren(viewLayout);
+            var securityList = LogicMethod.CurrLogicMethod.GetSecurityList();
+            for (int i = 0; i < securityList.Count; i++)
+            {
+                var security = securityList[i];
+                LogicView.SelectTypeView securityView = new LogicView.SelectTypeView();
+                securityView.btnText.Text = security.name;
+                securityView.btnIcon.UnSelectedImagePath = "LogicIcon/security.png";
+                viewLayout.AddChidren(securityView.FLayoutView());
+                securityView.btnClick.MouseUpEventHandler += (sen, e) =>
+                {
+                    SecurityMethod(this, security.sid);
+                };
+            }
+
+        }
+
+      
+        /// <summary>
+        /// 娣诲姞瀹夐槻
+        /// </summary>
+        public void SecurityMethod(FrameLayout frameLayout,string sid, bool edit = false, int index1 = -1)
+        {
+            string stateStr = "";
+            if (edit && index1 != -1)
+            {
+                Output output = Logic.currlogic.output[index1];
+                sid = output.sid;
+                for (int i = 0; i < output.status.Count; i++)
+                {
+                    var dic = output.status[i];
+                    if (dic.ContainsKey("value"))
+                    {
+                        if (dic["value"] == "enable")
+                        {
+                            stateStr = Language.StringByID(StringId.bufang);
+
+                        }
+                        else
+                        {
+                            stateStr = Language.StringByID(StringId.chefang);
+                        }
+                    }
+                }
+            }
+            PublicInterface conditionView = new PublicInterface();
+            var strList = conditionView.GetViewList("security");
+            conditionView.SingleSelectionShow(frameLayout, strList, Language.StringByID(StringId.addSecurityLogic), stateStr
+         , (stateValue) =>
+         {
+
+             string selecttionMode = "";
+             if (stateValue == Language.StringByID(StringId.bufang))
+             {
+                 selecttionMode = "enable";
+             }
+             else
+             {
+                 selecttionMode = "disable";
+             }
+             //灏佽鏁版嵁
+             Output outputDevice = new Output();
+             outputDevice.target_type = "3";
+             outputDevice.sid = sid;
+             outputDevice.status = new List<Dictionary<string, string>> { new Dictionary<string, string> { { "key", "security" }, { "value", selecttionMode } } };
+             AddOutput(outputDevice);
+             LogicMethod.CurrLogicMethod.RemoveAllView();
+             AddLogic addLogic = new AddLogic();
+             MainPage.BasePageView.AddChidren(addLogic);
+             addLogic.Show();
+             MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+
+         });
+           
+        }
+      
+        /// <summary>
+        /// 娣诲姞鐩爣
+        /// </summary>
+        /// <param name="target"></param>
+        /// <param name="bool_if">琛ㄧず鍚敤涓嶅悓鏉′欢</param>
+        private void AddOutput(Output target, bool bool_if = false)
+        {
+            int indexValue = -1;
+            for (int i = 0; i < Logic.currlogic.output.Count; i++)
+            {
+                if (bool_if)
+                {
+                    ///瀹夐槻鍏佽涓�绉�
+                    if (Logic.currlogic.output[i].target_type == target.target_type)
+                    {
+                        indexValue = i;
+                        break;
+                    }
+                }
+                else
+                {
+                    if (Logic.currlogic.output[i].sid == target.sid)
+                    {
+                        indexValue = i;
+                        break;
+                    }
+                }
+            }
+            if (indexValue != -1)
+            {
+                Logic.currlogic.output.RemoveAt(indexValue);
+                Logic.currlogic.output.Insert(indexValue, target);
+            }
+            else
+            {
+                Logic.currlogic.output.Add(target);
+            }
+
+        }
+    }
+}
\ No newline at end of file

--
Gitblit v1.8.0