From 09dfbfd9b77ec887c17b10f15799a1d3f56e4e17 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期二, 15 十二月 2020 12:04:42 +0800
Subject: [PATCH] 2020-12-15-1

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs |  240 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 239 insertions(+), 1 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
index ae55422..fe9cf05 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -1,10 +1,248 @@
 锘縰sing System;
+using System.Collections.Generic;
+using Shared;
 namespace HDL_ON.UI.UI2.Intelligence.Automation
 {
     public class PublicInterface
     {
-        public PublicInterface()
+        /// <summary>
+        /// 鍗曢�夋嫨
+        /// </summary>
+        /// <param name="frameLayout">鐖舵帶浠�</param>
+        /// <param name="list">鏄剧ず鏁版嵁婧�</param>
+        /// <param name="titleText"></param>
+        /// <param name="stateText">涔嬪墠鐘舵�佹枃鏈�</param>
+        /// <param name="action">杩斿洖鍊�</param>
+        /// <param name="textSize">鏄剧ず鏂囨湰瀛椾綋澶у皬</param>
+        public void SingleSelectionShow(FrameLayout frameLayout, List<string> list, string titleText, string stateText,Action<string> action, int textSize=LogicView.TextSize.text14)
         {
+            LogicView.DateView view = new LogicView.DateView();
+            view.btnTitle.Text = titleText;
+            view.FLayoutView(frameLayout, list.Count);
+            view.btnCancel.MouseUpEventHandler += (sender, e) =>
+            {
+                //绉婚櫎fLayout鐣岄潰
+                frameLayout.RemoveFromParent();
+            };
+            ///瀹氫箟涓�涓狟tn璁板綍閫変腑鐘舵��
+            Button checkBtn = new Button
+            {
+                Tag = "unknown",
+            };
+            for (int i = 0; i < list.Count; i++)
+            {
+                string str = list[i];
+                LogicView.CheckView checkView = new LogicView.CheckView();
+                checkView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i);
+                checkView.btnText.TextSize = textSize;
+                view.frameLayout.AddChidren(checkView.FLayoutView());
+                checkView.btnText.Text = str;
+                checkView.btnClick.Tag = str;//鏍囪
+
+                if (stateText == str)
+                {
+                    //鏄剧ず涔嬪墠鐨勯�変腑鐘舵��
+                    checkBtn.IsSelected = false;
+                    checkView.btnCheckIcon.IsSelected = true;
+                    checkBtn = checkView.btnCheckIcon;
+                    checkBtn.Tag = checkView.btnClick.Tag.ToString();
+                }
+                //鐐瑰嚮浜嬩欢
+                checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
+                {
+                    checkBtn.IsSelected = false;
+                    checkView.btnCheckIcon.IsSelected = true;
+                    checkBtn = checkView.btnCheckIcon;
+                    checkBtn.Tag = checkView.btnClick.Tag.ToString();
+                };
+
+            }
+            view.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
+            {
+                if (checkBtn.Tag.ToString() == "unknown")
+                {
+                    return;
+                }
+                action(checkBtn.Tag.ToString());
+                //绉婚櫎fLayout鐣岄潰
+                frameLayout.RemoveFromParent();
+            };
+
+        }
+        /// <summary>
+        /// 澶氶�夋嫨
+        /// </summary>
+        /// <param name="frameLayout">鐖舵帶浠�</param>
+        /// <param name="list">鏄剧ず鏁版嵁婧�</param>
+        /// <param name="titleText"></param>
+        /// <param name="stateTextList">涔嬪墠鐘舵�佹枃鏈�</param>
+        /// <param name="action">杩斿洖鍊�</param>
+        /// <param name="textSize">鏄剧ず鏂囨湰瀛椾綋澶у皬</param>
+        public void MultiSelectShow(FrameLayout frameLayout, List<string> list, string titleText, List<string> stateTextList, Action<List<string>> action, int textSize = LogicView.TextSize.text14)
+        {
+            LogicView.DateView view = new LogicView.DateView();
+            view.btnTitle.Text = titleText;
+            view.FLayoutView(frameLayout, list.Count);
+            view.btnCancel.MouseUpEventHandler += (sender, e) =>
+            {
+                //绉婚櫎fLayout鐣岄潰
+                view.frameLayout.RemoveFromParent();
+            };
+            for (int i = 0; i < list.Count; i++)
+            {
+                string str = list[i];
+                LogicView.CheckView checkView = new LogicView.CheckView();
+                checkView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i);
+                checkView.btnText.TextSize = textSize;
+                view.frameLayout.AddChidren(checkView.FLayoutView());
+                checkView.btnText.Text = str;
+                checkView.btnClick.Tag = str;//鏍囪
+
+                if (stateTextList.Contains(str))
+                {
+                    //鏄剧ず涔嬪墠鐨勯�変腑鐘舵��
+                    checkView.btnCheckIcon.IsSelected = true;
+                }
+                //鐐瑰嚮浜嬩欢
+                checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
+                {
+
+                    string clickIndex = checkView.btnClick.Tag.ToString();
+                    checkView.btnClick.IsSelected = !checkView.btnClick.IsSelected;
+                    if (checkView.btnClick.IsSelected)
+                    {
+                        checkView.btnCheckIcon.IsSelected = true;
+                        if (!stateTextList.Contains(clickIndex))
+                        {
+                            //娣诲姞閫変腑鏁版嵁
+                            stateTextList.Add(clickIndex);
+                        }
+                    }
+                    else
+                    {
+                        checkView.btnCheckIcon.IsSelected = false;
+                        if (stateTextList.Contains(clickIndex))
+                        {
+                            //绉婚櫎閫変腑鏁版嵁
+                            stateTextList.Remove(clickIndex);
+                        }
+                    }
+
+                };
+
+            }
+            view.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
+            {
+                if (stateTextList.Count == 0)
+                {
+                    return;
+                }
+                action(stateTextList);
+                //绉婚櫎fLayout鐣岄潰
+                frameLayout.RemoveFromParent();
+            };
+
+        }
+
+        /// <summary>
+        /// 鏈�-澶氶�夋嫨
+        /// </summary>
+        /// <param name="frameLayout">鐖舵帶浠�</param>
+        /// <param name="action">鏄剧ず鏂囨湰瀛椾綋澶у皬</param>
+        public void MonSelectShow(FrameLayout frameLayout,Logic logic, Action<List<string>> action)
+        {
+            LogicView.MonView monView = new LogicView.MonView();
+            monView.btnTitle.TextID = StringId.monthly;
+            monView.FLayoutView(frameLayout);
+            monView.btnCancel.MouseUpEventHandler += (sender, e) =>
+            {
+                monView.frameLayout.RemoveFromParent();
+            };
+            //瀹氫箟涓�涓眬閮╩onList鍒楄〃鐢ㄦ潵璁板綍閫変腑鏁版嵁;
+            List<string> monList = new List<string>();
+            if (logic.cycle.type == "mon")
+            {
+                //鍔犺浇涔嬪墠淇濆瓨鐨勬暟鎹�
+                monList.AddRange(logic.cycle.value);
+            }
+            //瀹氫箟涓�涓彉閲忚褰曡鏁�
+            int lineSun = 0;
+            for (int i = 1; i < 32; i++)
+            {
+                Button monTextBtn = new Button
+                {
+                    Width = Application.GetRealWidth(30),
+                    Height = Application.GetRealWidth(30),
+                    Radius = (uint)Application.GetRealWidth(15),
+                    Text = i.ToString(),
+                    TextSize = LogicView.TextSize.text14,
+                    TextColor = CSS.CSS_Color.textColor,
+                    SelectedTextColor = CSS.CSS_Color.view,
+                    SelectedBackgroundColor = CSS.CSS_Color.textConfirmColor,
+                    BackgroundColor = CSS.CSS_Color.viewTranslucence,
+                    Tag = i,
+                };
+                monView.frameLayout.AddChidren(monTextBtn);
+                if (lineSun > 0)
+                {
+                    monTextBtn.X = Application.GetRealWidth(16 + ((i - 1) - lineSun * 7) * 46);
+                }
+                else
+                {
+
+                    monTextBtn.X = Application.GetRealWidth(16 + (i - 1) * 46);
+                }
+                monTextBtn.Y = Application.GetRealWidth(58 + 10 + lineSun * (30 + 10));
+
+                if (i % 7 == 0)
+                {
+                    //涓�瀹氭墽琛屽畬鍐嶅垽鏂槸鍚﹁鎹㈣.
+                    lineSun = lineSun + 1;
+
+                }
+                monTextBtn.MouseUpEventHandler += (sender, e) =>
+                {
+                    string clickIndex = monTextBtn.Tag.ToString();
+                    monTextBtn.IsSelected = !monTextBtn.IsSelected;
+                    if (monTextBtn.IsSelected)
+                    {
+                        monTextBtn.IsSelected = true;
+                        if (!monList.Contains(clickIndex))
+                        {
+                            //娣诲姞閫変腑鏁版嵁
+                            monList.Add(clickIndex);
+                        }
+                    }
+                    else
+                    {
+                        monTextBtn.IsSelected = false;
+                        if (monList.Contains(clickIndex))
+                        {
+                            //绉婚櫎閫変腑鏁版嵁
+                            monList.Remove(clickIndex);
+                        }
+                    }
+                };
+
+                if (monList.Contains(i.ToString()))
+                {
+                    monTextBtn.IsSelected = true;
+                }
+            }
+            //纭畾鐐瑰嚮浜嬩欢
+            monView.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
+            {
+                if (monList.Count == 0)
+                {
+                    //鎻愮ず锛氳繕娌¢�変腑鎵ц鍛ㄦ湡
+                    return;
+                }
+       
+
+                action(monList);
+                frameLayout.RemoveFromParent();
+            };
+
         }
     }
 }

--
Gitblit v1.8.0