| | |
| | | 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 |
| | | { |
| | |
| | | /// 一行几个元素 |
| | | /// </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> |
| | |
| | | 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(); |
| | |
| | | { |
| | | buttonFram.AddBottomLine(); |
| | | } |
| | | buttonFram.GetNameButton().Text = d; |
| | | buttonFram.GetNameButton().Text = keypad.name; |
| | | |
| | | xCount++; |
| | | if (i % this.mRowNumber == 0) |
| | |
| | | { |
| | | if (buttonFram.Tag != null) |
| | | { |
| | | selectAction?.Invoke(buttonFram.Tag.ToString()); |
| | | selectAction?.Invoke((KeypadEntity)buttonFram.Tag); |
| | | } |
| | | }); |
| | | |
| | |
| | | /// <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; |
| | |
| | | //获取相对一个纬度值 |
| | | 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)) |
| | | { |
| | |
| | | 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)) |
| | | { |
| | | //加右线 |
| | |
| | | { |
| | | if (buttonFram.Tag != null) |
| | | { |
| | | selectAction?.Invoke(buttonFram.Tag.ToString()); |
| | | selectAction?.Invoke((KeypadEntity)buttonFram.Tag); |
| | | } |
| | | }); |
| | | |
| | |
| | | /// <summary> |
| | | ///动态加载数字按键界面 |
| | | /// </summary> |
| | | public void LoadNumberButtonPage() |
| | | public void LoadNumberButtonPage(List<KeypadEntity> mList) |
| | | { |
| | | |
| | | int currnetheightValue = 0; |
| | | int currnetWidthValue = 0; |
| | | int heightMaxValue = 84; |
| | |
| | | //获取相对一个纬度值 |
| | | 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, |
| | | }; |
| | |
| | | } |
| | | 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) => |
| | | { |
| | |
| | | /// <summary> |
| | | /// 动态加载图片界面 |
| | | /// </summary> |
| | | public void LoadImagePage() |
| | | public void LoadImagePage(List<KeypadEntity> mList) |
| | | { |
| | | int currnetheightValue = 0; |
| | | int currnetWidthValue = 0; |
| | |
| | | //获取相对一个纬度值 |
| | | 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)) |
| | | { |
| | |
| | | { |
| | | if (imageFram.Tag != null) |
| | | { |
| | | selectAction?.Invoke(imageFram.Tag.ToString()); |
| | | selectAction?.Invoke((KeypadEntity)imageFram.Tag); |
| | | } |
| | | }); |
| | | //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i) |
| | |
| | | /// 动态加载图片界面 |
| | | /// </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) |
| | |
| | | { |
| | | if (imageFram.Tag != null) |
| | | { |
| | | selectAction?.Invoke(imageFram.Tag.ToString()); |
| | | selectAction?.Invoke((KeypadEntity)imageFram.Tag); |
| | | } |
| | | }); |
| | | |
| | |
| | | /// <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) |
| | |
| | | |
| | | |
| | | |
| | | 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" |
| | | |
| | | }; |
| | | |
| | | } |
| | | } |
| | | } |