From a46cd0adb5af29e8a9cf47c219475acaedfcf839 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 01 十二月 2020 17:09:00 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/WJC'

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

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
new file mode 100644
index 0000000..ecfd441
--- /dev/null
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
@@ -0,0 +1,193 @@
+锘縰sing System;
+using HDL_ON.UI.UI2.Intelligence.Automation.LogicView;
+using Shared;
+using System.Collections.Generic;
+namespace HDL_ON.UI.UI2.Intelligence.Automation
+{
+    public class MainView
+    {
+        /// <summary>
+        /// 璁板綍閫昏緫鑷姩鍖栫埗鎺т欢
+        /// </summary>
+        public static FrameLayout automationPage;
+        /// <summary>
+        /// 鍔犺浇閫昏緫鍒楄〃鏄剧ず鐣岄潰
+        /// </summary>
+        public static void MainShow()
+        {
+            automationPage.RemoveAll();
+            VerticalScrolViewLayout vv = new VerticalScrolViewLayout();
+            automationPage.AddChidren(vv);
+
+            for (int i = 0; i < Logic.LogicList.Count; i++)
+            {
+                var currLogic = Logic.LogicList[i];
+                ///涓婁笅闂撮殧12鍍忕礌
+                vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) });
+                LogicView.SingleLogicView logicView = new LogicView.SingleLogicView();
+                vv.AddChidren(logicView.FLayoutView());
+                logicView.btnLogicName.Text = currLogic.name;
+                logicView.btnWeekText.Text = GetWeekText(currLogic);
+                logicView.btnclick.MouseUpEventHandler += (sen, e) =>
+                {
+                    Logic.currlogic = currLogic;
+                    var addLogic = new AddLogic();
+                    MainPage.BasePageView.AddChidren(addLogic);
+                    addLogic.Show();
+                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                };
+                logicView.btnSwitchIcon.MouseUpEventHandler += (sender1, e1) =>
+                {
+                    logicView.btnSwitchIcon.IsSelected = !logicView.btnSwitchIcon.IsSelected;
+                    if (logicView.btnSwitchIcon.IsSelected)
+                    {
+                        logicView.btnSwitchIcon.IsSelected = true;
+                    }
+                    else
+                    {
+                        logicView.btnSwitchIcon.IsSelected = false;
+                    }
+                };
+                if (currLogic.enable == "true")
+                {
+                    logicView.btnSwitchIcon.IsSelected = true;
+                }
+                else
+                {
+                    logicView.btnSwitchIcon.IsSelected = false;
+                }
+            }
+
+            if (Logic.LogicList.Count == 0)
+            {
+                Button btnTipNot = new Button()
+                {
+                    Gravity = Gravity.CenterHorizontal,
+                    Y = Application.GetRealHeight(120),
+                    Width = Application.GetRealWidth(180),
+                    Height = Application.GetRealWidth(180),
+                    UnSelectedImagePath = "TipNot.png",
+                };
+                automationPage.AddChidren(btnTipNot);
+                Button btnTipNotText = new Button()
+                {
+                    Y = btnTipNot.Bottom,
+                    Height = Application.GetRealWidth(100),
+                    TextID = StringId.TipNotOpen,
+                    TextAlignment = TextAlignment.Center,
+                    TextColor = CSS.CSS_Color.TextualColor,
+                    TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel,
+                };
+                automationPage.AddChidren(btnTipNotText);
+            }
+        }
+        /// <summary>
+        ///  鎸�+璺宠浆鍒伴�昏緫鐣岄潰鐨勬柟娉�
+        /// </summary>
+        public static void SkipAddLogicPage()
+        {
+            Logic.currlogic = new Logic();
+            var addLogic = new AddLogic();
+            MainPage.BasePageView.AddChidren(addLogic);
+            addLogic.Show();
+            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+        }
+        /// <summary>
+        ///杩斿洖寰幆鎻忚堪鏂囨湰
+        /// </summary>
+        /// <param name="logic"></param>
+        public static string GetWeekText(Logic logic)
+        {
+
+            string weekName = "";
+            /// (鎵ц涓�娆�:once锛屾瘡澶�:day锛屾瘡鏈�:mon锛屾槦鏈�:week锛屾棩鏈熸:date_to_date)
+            switch (logic.cycle.type)
+            {
+                case "once":
+                    {
+                        weekName = Language.StringByID(StringId.performA);
+                    }
+                    break;
+                case "day":
+                    {
+                        weekName = Language.StringByID(StringId.days);
+                    }
+                    break;
+                case "week":
+                    {
+
+                        weekName = GetWeekString(logic.cycle.value);
+
+                    }
+                    break;
+                case "mon":
+                    {
+                        weekName = GetMonString(logic.cycle.value);
+                    }
+                    break;
+            }
+            return weekName;
+        }
+        /// <summary>
+        /// 鑾峰彇鏄熸湡鐨勫瓧绗︿覆
+        /// </summary>
+        /// <param name="weekList"></param>
+        /// <returns></returns>
+        public static string GetWeekString(List<string> weekList)
+        {
+            string weekTextName = "";
+
+            if (weekList.Contains("0"))
+            {
+                weekTextName += Language.StringByID(StringId.monday) + ",";
+            }
+            if (weekList.Contains("1"))
+            {
+                weekTextName += Language.StringByID(StringId.tuesday) + ",";
+            }
+            if (weekList.Contains("2"))
+            {
+                weekTextName += Language.StringByID(StringId.wednesday) + ",";
+            }
+            if (weekList.Contains("3"))
+            {
+                weekTextName += Language.StringByID(StringId.thursday) + ",";
+            }
+            if (weekList.Contains("4"))
+            {
+                weekTextName += Language.StringByID(StringId.friday) + ",";
+            }
+            if (weekList.Contains("5"))
+            {
+                weekTextName += Language.StringByID(StringId.saturday) + ",";
+            }
+            if (weekList.Contains("6"))
+            {
+                weekTextName += Language.StringByID(StringId.sunday) + ",";
+            }
+            if (weekTextName == "")
+            {
+                return "";
+            }
+            return weekTextName.TrimEnd(',');
+        }
+        /// <summary>
+        /// 鑾峰彇姣忔湀鐨勫瓧绗︿覆
+        /// </summary>
+        /// <param name="monList"></param>
+        /// <returns></returns>
+        public static string GetMonString(List<string> monList)
+        {
+            string monTextName = Language.StringByID(StringId.monthly);
+
+            for (int i = 1; i < 32; i++)
+            {
+                if (monList.Contains(i.ToString()))
+                {
+                    monTextName += i.ToString() + ",";
+                }
+            }
+            return monTextName.TrimEnd(',');
+        }
+    }
+}

--
Gitblit v1.8.0