From f9181a9c8125136f597add7c30cb2ff508d54ba7 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期四, 25 七月 2024 17:34:32 +0800 Subject: [PATCH] 2024年07月25日17:33:40 --- HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs | 138 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 138 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 index a073cc9..97fb64a 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs @@ -1,10 +1,92 @@ 锘縰sing System; using System.Collections.Generic; +using System.Linq; +using System.Reflection; using Shared; namespace HDL_ON.UI.UI2.Intelligence.Automation { public class PublicInterface { + + /// <summary> + /// 鍗曢�夋嫨 + /// </summary> + /// <param name="frame">鏄剧ず鍦ㄥ摢涓晫闈㈢殑鐖舵帶浠�</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 frame, List<FuntionControlView.Aks.Entity.RemoteControlEntity> list, string titleText, string stateText, Action<int> action, int textSize = LogicView.TextSize.text14) + { + if (list == null) + { + return; + } + FrameLayout frameLayout = new FrameLayout + { + BackgroundColor = CSS.CSS_Color.viewTrans60lucence, + }; + frame.AddChidren(frameLayout); + + 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++) + { + FuntionControlView.Aks.Entity.RemoteControlEntity remoteControl = 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 = remoteControl.name; + checkView.btnClick.Tag = i;//鏍囪 + + if (stateText == remoteControl.name) + { + //鏄剧ず涔嬪墠鐨勯�変腑鐘舵�� + 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; + } + var index = int.Parse(checkBtn.Tag.ToString()); + if (index > list.Count) + { + index = 0; + } + action(index); + //绉婚櫎fLayout鐣岄潰 + frameLayout.RemoveFromParent(); + }; + + } /// <summary> /// 鍗曢�夋嫨 /// </summary> @@ -341,6 +423,7 @@ /// <param name="stateList">涔嬪墠鐘舵�佹暟鎹簮</param> /// <param name="titleText">鏍囬</param> /// <param name="action">杩斿洖鍊肩储寮曞��</param> + /// <param name="isIcon">鏁版嵁婧愭病鏈夋暟鎹槸鍚︽樉绀烘彁绀哄浘鏍�(榛樿(true)鏄剧ず)</param> public void FrameOrVv(FrameLayout frame, List<string> list, List<string> stateList, string titleText, Action<int> action,bool isIcon=true) { @@ -1304,6 +1387,61 @@ return value; } + + /// <summary> + /// 鑾峰彇key鍊� + /// </summary> + /// <param name="value"></param> + /// <returns>涓嶅瓨鍦ㄨ繑鍥炵┖瀛楃鈥溾��</returns> + public string GetKey(Dictionary<string, string> dic, string value) + { + if (string.IsNullOrEmpty(value)) { + return string.Empty; + } + if (dic==null||dic.Count==0) + { + return string.Empty; + } + //濡傛灉鍑虹幇澶氫釜鐩稿悓Value锛岃繖閲岄粯璁よ繑鍥炴槸绗竴涓猭ey鍊� + var key = dic.FirstOrDefault(q => q.Value == value).Key; + return key == null ? string.Empty : key; + } + + /// <summary> + /// 鑾峰彇value鍊� + /// </summary> + /// <param name="key">閿�</param> + /// <returns>涓嶅瓨鍦ㄨ繑鍥炵┖瀛楃鈥溾��</returns> + public string GetValue(Dictionary<string, string> dic, string key) + { + if (string.IsNullOrEmpty(key)) + { + return string.Empty; + } + if (dic == null || dic.Count == 0) + { + return string.Empty; + } + string value = string.Empty; + dic.TryGetValue(key, out value); + return value == null ? string.Empty : value; + } + /// <summary> + /// 鑾峰彇娴蜂俊鐢佃淇″彿婧愬垪琛�( 0:LiveTV;2:PS;3:HDMI_1;4:HDMI_2;5:HDMI_3;6:HDMI_4;11:AV;) + /// </summary> + /// <returns></returns> + public Dictionary<string, string> GetHisenseSignalSourceDic() + { + var dic = new Dictionary<string, string>(); + dic.Add("HDML 1", "3"); + dic.Add("HDML 2", "4"); + dic.Add("HDML 3", "5"); + dic.Add("HDML 4", "6"); + dic.Add("Live TV", "0"); + dic.Add("PS", "2"); + dic.Add("AV", "11"); + return dic; + } } } -- Gitblit v1.8.0