From 82423359112f65458fd9a80418da0bda5e9364d9 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期五, 11 十二月 2020 17:08:56 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/WJC' into NewFilePath --- HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs | 145 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 145 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs new file mode 100644 index 0000000..b72d257 --- /dev/null +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs @@ -0,0 +1,145 @@ +锘縰sing System; +using System.Collections.Generic; +using Shared; +namespace HDL_ON.UI.UI2.Intelligence.Automation +{ + public class PublicInterface + { + /// <summary> + /// 鍗曢�夋嫨 + /// </summary> + /// <param name="frameLayout">鐖舵帶浠�</param> + /// <param name="list">鏄剧ず鏁版嵁婧�</param> + /// <param name="titleText"></param> + /// <param name="stateText">涔嬪墠鐘舵�佹枃鏈�</param> + /// <param name="action">杩斿洖鍊�</param> + public void SingleSelectionShow(FrameLayout frameLayout, List<string> list, string titleText, string stateText, Action<string> action) + { + 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); + 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> + public void MultiSelectShow(FrameLayout frameLayout, List<string> list, string titleText, List<string> stateTextList, Action<List<string>> action) + { + 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); + 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(); + }; + + } + + + } +} -- Gitblit v1.8.0