From c877bc16eb02df246e48377101af0fa5ec626c14 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 23 八月 2021 10:00:49 +0800
Subject: [PATCH] Merge branch 'WJC' into wxr7

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/Security.cs |  146 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 146 insertions(+), 0 deletions(-)

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