From 922dcfb535b7c9d8bd4ab1d97ebc50b49237b0df Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期三, 09 八月 2023 14:36:42 +0800 Subject: [PATCH] 2023年08月09日14:36:17 --- HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs | 135 ++++++++++++++++---------------------------- 1 files changed, 50 insertions(+), 85 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs index 443c3e0..9f4dac2 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs @@ -2,6 +2,7 @@ using HDL_ON.UI.Music; using Shared; using System.Collections.Generic; +using HDL_ON.UI.UI2.FuntionControlView.Aks.Entity; namespace HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView { @@ -18,10 +19,12 @@ /// 涓�琛屽嚑涓厓绱� /// </summary> private int mRowNumber; + /// <summary> + /// 鍒楄〃鏈�澶у�� + /// </summary> + private int mListCount; - private List<string> mList; - - public Action<string> selectAction = null; + public Action<KeypadEntity> selectAction = null; /// <summary> /// 褰撳墠閫夋嫨鐨勭储寮�(鍐呴儴浣跨敤) /// </summary> @@ -58,58 +61,37 @@ this.rightMargin = right; } - /// <summary> - /// 璁剧疆鍒楄〃鏁版嵁(璇峰湪鍒濆鍖栧畬鎴愪箣鍓嶈皟鐢�) - /// </summary> - /// <param name="list"></param> - public void SetList(List<string> list) - { - if (list == null) - { - list = new List<string>(); - } - this.mList = list; - } + /// <summary> /// 鑾峰彇娴嬭瘯鍒楄〃鏁版嵁 /// </summary> - public List<string> GetTestList(int count) + public List<KeypadEntity> GetTestList() { - var list = new List<string>(); - for (int i = 1; i <= count; i++) - { - if (i % 2 == 0) - { - list.Add("浣犲ソ鍌诲摝!"); - } - else - { - list.Add("鐪熺殑鏄繖鏍风殑鍚�?"); - } - } - return list; + return AksCommonMethod.Current.GetTYYKeypadList(); } /// <summary> /// 鍔ㄦ�佸姞杞芥寜閿晫闈� /// </summary> + /// <param name="mList">鍒楄〃</param> /// <param name="mRowNumber">涓�琛屽灏戜釜鍏冪礌</param> - public void LoadButtonPage(int mRowNumber) + public void LoadButtonPage(List<KeypadEntity> mList, int mRowNumber) { if (mRowNumber == 0) { return; } this.mRowNumber = mRowNumber; + this.mListCount = mList.Count; int line = 0; int xCount = 0; - for (int i = 1; i <= this.mList.Count; i++) + for (int i = 1; i <= mList.Count; i++) { - var d = this.mList[i - 1]; + var keypad = mList[i - 1]; ButtonFramLayout buttonFram = new ButtonFramLayout(); this.AddChidren(buttonFram); - buttonFram.Tag = d; + buttonFram.Tag = keypad; buttonFram.Y = Application.GetRealHeight(this.topMargin) + Application.GetRealHeight(ButtonFramLayout.heightFrameLayout * line); buttonFram.X = Application.GetRealWidth(this.leftMargin) + Application.GetRealWidth(ButtonFramLayout.widthFrameLayout * xCount); buttonFram.AddImageView(); @@ -122,7 +104,7 @@ { buttonFram.AddBottomLine(); } - buttonFram.GetNameButton().Text = d; + buttonFram.GetNameButton().Text = keypad.name; xCount++; if (i % this.mRowNumber == 0) @@ -135,7 +117,7 @@ { if (buttonFram.Tag != null) { - selectAction?.Invoke(buttonFram.Tag.ToString()); + selectAction?.Invoke((KeypadEntity)buttonFram.Tag); } }); @@ -151,8 +133,9 @@ /// <summary> /// 鍔ㄦ�佸姞杞芥寜閿晫闈� /// </summary> - /// <param name="list">绱㈠紩鍒楄〃,琛ㄧず鏌愪竴鏉″搴﹀姞瀹�</param> - public void LoadButtonPage(List<int> list) + /// <param name="mList">鍒楄〃</param> + /// <param name="list">鍒楄〃涓储寮�,琛ㄧず鏌愪竴鏉″搴﹀姞瀹�</param> + public void LoadButtonPage(List<KeypadEntity> mList, List<int> list) { int currnetheightValue = 0; @@ -160,9 +143,9 @@ //鑾峰彇鐩稿涓�涓含搴﹀�� int heightDimensionValue = this.Height - Application.GetRealHeight(this.topMargin) - Application.GetRealHeight(this.bottomMargin) - Application.GetRealHeight(ButtonFramLayout.heightFrameLayout / 2); int widthDimensionValue = this.Width - Application.GetRealWidth(this.leftMargin) - Application.GetRealWidth(this.rightMargin) - Application.GetRealHeight(ButtonFramLayout.widthFrameLayout / 2); - for (int i = 1; i <= this.mList.Count; i++) + for (int i = 1; i <= mList.Count; i++) { - var d = this.mList[i - 1]; + var keypad = mList[i - 1]; ButtonFramLayout buttonFram = null; if (list.Contains(i)) { @@ -183,8 +166,8 @@ this.AddChidren(buttonFram); buttonFram.AddImageView(); buttonFram.AddNameView(); - buttonFram.Tag = d;//鏍囪鏁版嵁 - buttonFram.GetNameButton().Text = d.ToString(); + buttonFram.Tag = keypad;//鏍囪鏁版嵁 + buttonFram.GetNameButton().Text = keypad.name; if (widthDimensionValue > Application.GetRealWidth(currnetWidthValue)) { //鍔犲彸绾� @@ -207,7 +190,7 @@ { if (buttonFram.Tag != null) { - selectAction?.Invoke(buttonFram.Tag.ToString()); + selectAction?.Invoke((KeypadEntity)buttonFram.Tag); } }); @@ -221,8 +204,9 @@ /// <summary> ///鍔ㄦ�佸姞杞芥暟瀛楁寜閿晫闈� /// </summary> - public void LoadNumberButtonPage() + public void LoadNumberButtonPage(List<KeypadEntity> mList) { + int currnetheightValue = 0; int currnetWidthValue = 0; int heightMaxValue = 84; @@ -230,21 +214,21 @@ //鑾峰彇鐩稿涓�涓含搴﹀�� int heightDimensionValue = this.Height - Application.GetRealHeight(this.topMargin) - Application.GetRealHeight(this.bottomMargin) - Application.GetRealHeight(heightMaxValue / 2); int widthDimensionValue = this.Width - Application.GetRealWidth(this.leftMargin) - Application.GetRealWidth(this.rightMargin) - Application.GetRealHeight(widthMaxValue / 2); - for (int i = 1; i <= this.GetNumberTextList().Count; i++) + for (int i = 1; i <= mList.Count; i++) { - var d = this.GetNumberTextList()[i - 1]; + var keypad = mList[i - 1]; Button button = new Button { Y = Application.GetRealHeight(this.topMargin) + Application.GetRealHeight(currnetheightValue), X = Application.GetRealWidth(this.leftMargin) + Application.GetRealWidth(currnetWidthValue), Width = Application.GetRealWidth(widthMaxValue), Height = Application.GetRealHeight(heightMaxValue), - Text = d, + Text = keypad.name, TextSize = TextSize.Text20, TextColor = MusicColor.TextColor, TextAlignment = TextAlignment.Center, IsBold = true, - Tag = d, + Tag = keypad, BackgroundColor = MusicColor.WhiteColor, SelectedBackgroundColor = 0xff454635, }; @@ -258,12 +242,12 @@ } button.MouseDownEventHandler += (sen, e) => { - if (button.Tag == null || string.IsNullOrEmpty(button.Tag.ToString())) + if (button.Tag == null || ((KeypadEntity)button.Tag).keypad == "none") { return; } button.IsSelected = true; - selectAction?.Invoke(button.Tag.ToString()); + selectAction?.Invoke((KeypadEntity)button.Tag); }; button.MouseUpEventHandler += (sen, e) => { @@ -280,7 +264,7 @@ /// <summary> /// 鍔ㄦ�佸姞杞藉浘鐗囩晫闈� /// </summary> - public void LoadImagePage() + public void LoadImagePage(List<KeypadEntity> mList) { int currnetheightValue = 0; int currnetWidthValue = 0; @@ -289,15 +273,15 @@ //鑾峰彇鐩稿涓�涓含搴﹀�� int heightDimensionValue = this.Height - Application.GetRealHeight(this.topMargin) - Application.GetRealHeight(this.bottomMargin) - Application.GetRealHeight(heightMaxValue / 2); int widthDimensionValue = this.Width - Application.GetRealWidth(this.leftMargin) - Application.GetRealWidth(this.rightMargin) - Application.GetRealHeight(widthMaxValue / 2); - for (int i = 1; i <= this.mList.Count; i++) + for (int i = 1; i <= mList.Count; i++) { - var d = this.mList[i - 1]; + var keypad = mList[i - 1]; ImageFramlayout imageFram = new ImageFramlayout(); imageFram.AddView(this); - imageFram.Tag = d; + imageFram.Tag = keypad; imageFram.Y = Application.GetRealHeight(this.topMargin) + Application.GetRealHeight(currnetheightValue); imageFram.X = Application.GetRealWidth(currnetWidthValue); - imageFram.btnName.Text = d; + imageFram.btnName.Text = keypad.name; currnetWidthValue += (widthMaxValue + 8);//8鏄殧闂村�� if (widthDimensionValue < Application.GetRealWidth(currnetWidthValue)) { @@ -309,7 +293,7 @@ { if (imageFram.Tag != null) { - selectAction?.Invoke(imageFram.Tag.ToString()); + selectAction?.Invoke((KeypadEntity)imageFram.Tag); } }); //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i) @@ -322,24 +306,26 @@ /// 鍔ㄦ�佸姞杞藉浘鐗囩晫闈� /// </summary> /// <param name="mRowNumber">涓�琛屽灏戜釜鍏冪礌</param> - public void LoadImagePage(int mRowNumber) + public void LoadImagePage(List<KeypadEntity> mList, int mRowNumber) { + if (mRowNumber == 0) { return; } + this.mListCount = mList.Count; this.mRowNumber = mRowNumber; int line = 0; int xCount = 0; - for (int i = 1; i <= this.mList.Count; i++) + for (int i = 1; i <= mList.Count; i++) { - var d = this.mList[i - 1]; + var keypad = mList[i - 1]; ImageFramlayout imageFram = new ImageFramlayout(); imageFram.AddView(this); - imageFram.Tag = d; + imageFram.Tag = keypad; imageFram.Y = Application.GetRealHeight(this.topMargin) + Application.GetRealHeight((ImageFramlayout.heightFrameLayout + 20) * line); imageFram.X = Application.GetRealWidth((ImageFramlayout.widthFrameLayout + 8) * xCount); - imageFram.btnName.Text = d; + imageFram.btnName.Text = keypad.name; xCount++; if (i % this.mRowNumber == 0) @@ -352,7 +338,7 @@ { if (imageFram.Tag != null) { - selectAction?.Invoke(imageFram.Tag.ToString()); + selectAction?.Invoke((KeypadEntity)imageFram.Tag); } }); @@ -381,12 +367,12 @@ /// <returns></returns> private bool IsLastColumn(int index) { - if (this.mRowNumber == 0 || this.mList == null || this.mList.Count == 0) + if (this.mRowNumber == 0 || mListCount == 0) { return false; } - int lineCount = this.mList.Count / this.mRowNumber;//寰楀嚭琛屾暟 - int number = this.mList.Count % this.mRowNumber; + int lineCount = mListCount / this.mRowNumber;//寰楀嚭琛屾暟 + int number = mListCount % this.mRowNumber; if (number != 0) { if (index > lineCount * this.mRowNumber) @@ -462,27 +448,6 @@ - public List<string> GetNumberTextList() - { - return new List<string> - { - "1", - "2", - "3", - Language.StringByID(StringId.pindaojia), - "4", - "5", - "6", - Language.StringByID(StringId.pindaojian), - "7", - "8", - "9", - "-/--", - "",//杩欎釜鏄负浜嗗崰浣嶇疆 - "0" - }; - - } } } -- Gitblit v1.8.0