From eda3fb873e59544ff36301b51e05aef64f87b0f9 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期五, 27 八月 2021 13:21:21 +0800
Subject: [PATCH] Merge branch 'newBranch1' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into newBranch1

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

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs
new file mode 100644
index 0000000..2ea187d
--- /dev/null
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs
@@ -0,0 +1,132 @@
+锘縰sing System;
+using System.Collections.Generic;
+using Shared;
+namespace HDL_ON.UI.UI2.Intelligence.Automation
+{
+    public class AirQuality : FrameLayout
+    {
+        public AirQuality()
+        {
+            Tag = "Logic";
+        }
+        public void Show()
+        {
+            #region  鐣岄潰甯冨眬
+            LogicView.TopView topView = new LogicView.TopView();
+            topView.frameLayout.Height = Application.GetRealHeight(64 + 20);
+            this.AddChidren(topView.FLayoutView());
+            topView.topNameBtn.TextID = StringId.selectionCondition;
+            topView.Location();
+            topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
+            {
+                RemoveFromParent();
+            };
+
+            FrameLayout viewLayout = new FrameLayout
+            {
+                Y = Application.GetRealHeight(64 + 20),
+                Width = Application.GetRealWidth(LogicView.TextSize.view375),
+                Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64 - 20),
+                BackgroundColor = CSS.CSS_Color.viewMiddle,
+            };
+            this.AddChidren(viewLayout);
+            #endregion
+
+            var list = new List<string> {
+                Language.StringByID(StringId.kongqiyou),
+                Language.StringByID(StringId.kongqiliang),
+                Language.StringByID(StringId.kongqicha),
+            };
+            for (int i = 0; i < list.Count; i++)
+            {
+                LogicView.SelectTypeView view = new LogicView.SelectTypeView();
+                view.frameLayout.Y = Application.GetRealHeight(i * 50);
+                view.btnIcon.Visible = false;
+                view.btnNextIcon.Visible = false;
+                view.btnText.X = Application.GetRealWidth(16);
+                view.btnLine.X = Application.GetRealWidth(16);
+                view.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
+                view.btnText.Text = list[i];
+                view.btnClick.Tag = list[i];
+                viewLayout.AddChidren(view.FLayoutView());
+
+                view.btnClick.MouseUpEventHandler += (sen, e) =>
+                {
+                    string value = "";
+                    string text = view.btnClick.Tag.ToString();
+                    if (text == Language.StringByID(StringId.kongqiyou))
+                    {
+                        //浼�
+                        value = "excellent";
+                    }
+                    else if (text == Language.StringByID(StringId.kongqiliang))
+                    {
+                        //鑹�
+                        value = "good";
+                    }
+                    else if (text == Language.StringByID(StringId.kongqicha))
+                    {
+                        //宸�
+                        value = "poor";
+                    }
+                    AddDic(value);
+                };
+            }
+      
+        }
+        /// <summary>
+        /// 灏佽鏁版嵁
+        /// </summary>
+        /// <param name="value"></param>
+        private void AddDic(string value)
+        {
+            Input input = new Input();
+            input.sid = LogicMethod.CurrLogicMethod.NewSid();
+            input.condition_type = "9";
+            Dictionary<string, string> dic = new Dictionary<string, string>();
+            LogicMethod.CurrLogicMethod.dictionary(dic, "key", "air_quality");
+            LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
+            LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
+            LogicMethod.CurrLogicMethod.dictionary(dic, "value", value);
+            input.condition.Add(dic);
+            AddCondition(input);
+        }
+        /// <summary>
+        /// 娣诲姞鏉′欢
+        /// </summary>
+        /// <param name="input"></param>
+        private void AddCondition(Input input)
+        {
+            ///璁板綍绱㈠紩鍊�
+            int index = -1;
+            for (var i = 0; i < Logic.currlogic.input.Count; i++)
+            {
+                var condition_type = Logic.currlogic.input[i].condition_type;
+                if (condition_type == "9")
+                {
+                    ///鎵惧埌鏍囪绱㈠紩锛岄��鍑哄惊鐜綋
+                    index = i;
+                    break;
+                }
+            }
+            if (index != -1)
+            {
+                //绉婚櫎鏃ф暟鎹�
+                Logic.currlogic.input.RemoveAt(index);
+                //鏂版暟鎹彃鍏ユ棫鏁版嵁鐨勪綅缃�
+                Logic.currlogic.input.Insert(index, input);
+            }
+            else
+            {
+                Logic.currlogic.input.Add(input);
+            }
+
+            LogicMethod.CurrLogicMethod.RemoveAllView();
+            AddLogic addLogic = new AddLogic();
+            MainPage.BasePageView.AddChidren(addLogic);
+            addLogic.Show();
+            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+
+        }
+    }
+}

--
Gitblit v1.8.0