| | |
| | | using System; |
| | | using HDL_ON.UI.Music; |
| | | using HDL_ON.UI.UI2.FuntionControlView.Aks.Entity; |
| | | using Shared; |
| | | namespace HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView |
| | | { |
| | | public class MenuFramLayout : BaseFramLayout |
| | | { |
| | | |
| | | public const int widthFrameLayout = 180; |
| | | public const int heightFrameLayout = 180; |
| | | public const int cornerValue = 90; |
| | | |
| | | public MenuFramLayout(int width = widthFrameLayout, int height = heightFrameLayout) |
| | | { |
| | | this.Width = Application.GetMinRealAverage(width); |
| | | this.Height = Application.GetMinRealAverage(height); |
| | | this.Radius = (uint)Application.GetRealHeight(cornerValue); |
| | | this.Width = Application.GetRealWidth(width); |
| | | this.Height = Application.GetRealWidth(height); |
| | | this.Radius = (uint)Application.GetRealWidth(cornerValue); |
| | | this.BackgroundColor = MusicColor.ViewColor; |
| | | this.Gravity = Gravity.CenterHorizontal; |
| | | } |
| | | Button btnTop = new Button |
| | | { |
| | | Y = Application.GetMinRealAverage(16), |
| | | X = Application.GetMinRealAverage(78), |
| | | Width = Application.GetRealWidth(24), |
| | | Height = Application.GetRealHeight(20), |
| | | Y = Application.GetRealWidth(16), |
| | | X = Application.GetRealWidth(78), |
| | | Width = Application.GetRealWidth(24),//高度和宽高不一样,以宽度为维度计算,否则变形 |
| | | Height = Application.GetRealWidth(20), |
| | | UnSelectedImagePath = "AksIcon/shang.png", |
| | | SelectedImagePath = "AksIcon/shang_selected.png", |
| | | Name = "上", |
| | | }; |
| | | |
| | | Button btnTopClick = new Button |
| | | { |
| | | X = Application.GetRealWidth(52), |
| | | Width = Application.GetRealWidth(76), |
| | | Height = Application.GetRealHeight(40), |
| | | }; |
| | | Button btnBottom = new Button |
| | | { |
| | | Y = Application.GetMinRealAverage(144), |
| | | X = Application.GetMinRealAverage(78), |
| | | Y = Application.GetRealWidth(144), |
| | | X = Application.GetRealWidth(78), |
| | | Width = Application.GetRealWidth(24), |
| | | Height = Application.GetRealHeight(20), |
| | | Height = Application.GetRealWidth(20), |
| | | UnSelectedImagePath = "AksIcon/xia.png", |
| | | SelectedImagePath = "AksIcon/xia_selected.png", |
| | | Name = "下", |
| | | }; |
| | | Button btnBottomClick = new Button |
| | | { |
| | | Y = Application.GetRealWidth(128), |
| | | X = Application.GetRealWidth(52), |
| | | Width = Application.GetRealWidth(76), |
| | | Height = Application.GetRealHeight(52), |
| | | }; |
| | | Button btnLeft = new Button |
| | | { |
| | | Y = Application.GetMinRealAverage(78), |
| | | X = Application.GetMinRealAverage(16), |
| | | Y = Application.GetRealWidth(78), |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(20), |
| | | Height = Application.GetRealHeight(24), |
| | | Height = Application.GetRealWidth(24), |
| | | UnSelectedImagePath = "AksIcon/zuo.png", |
| | | SelectedImagePath = "AksIcon/zuo_selected.png", |
| | | Name = "左", |
| | | |
| | | }; |
| | | |
| | | Button btnLeftClick = new Button |
| | | { |
| | | Y = Application.GetRealWidth(52), |
| | | Width = Application.GetRealWidth(52), |
| | | Height = Application.GetRealHeight(76), |
| | | |
| | | }; |
| | | Button btnRight = new Button |
| | | { |
| | | Y = Application.GetMinRealAverage(78), |
| | | X = Application.GetMinRealAverage(144), |
| | | Y = Application.GetRealWidth(78), |
| | | X = Application.GetRealWidth(144), |
| | | Width = Application.GetRealWidth(20), |
| | | Height = Application.GetRealHeight(24), |
| | | Height = Application.GetRealWidth(24), |
| | | UnSelectedImagePath = "AksIcon/you.png", |
| | | SelectedImagePath = "AksIcon/you_selected.png", |
| | | Name = "右", |
| | | |
| | | }; |
| | | |
| | | Button btnRightClick = new Button |
| | | { |
| | | X = Application.GetRealWidth(128), |
| | | Y = Application.GetRealWidth(52), |
| | | Width = Application.GetRealWidth(52), |
| | | Height = Application.GetRealHeight(76), |
| | | |
| | | }; |
| | | |
| | | Button btnOkbj = new Button |
| | | { |
| | | Y = Application.GetMinRealAverage(52), |
| | | X = Application.GetMinRealAverage(52), |
| | | Width = Application.GetMinRealAverage(76), |
| | | Height = Application.GetMinRealAverage(76), |
| | | Radius = (uint)Application.GetRealHeight(38), |
| | | Gravity = Gravity.Center, |
| | | Width = Application.GetRealWidth(76), |
| | | Height = Application.GetRealWidth(76), |
| | | Radius = (uint)Application.GetRealWidth(38), |
| | | BackgroundColor = MusicColor.WhiteColor, |
| | | |
| | | |
| | | }; |
| | | Button btnOk = new Button |
| | | { |
| | | Y = Application.GetMinRealAverage(76), |
| | | X = Application.GetMinRealAverage(76), |
| | | Width = Application.GetMinRealAverage(28), |
| | | Height = Application.GetMinRealAverage(28), |
| | | Radius = (uint)Application.GetRealHeight(14), |
| | | BackgroundColor = MusicColor.SelectedColor, |
| | | Gravity = Gravity.Center, |
| | | Width = Application.GetRealWidth(28), |
| | | Height = Application.GetRealWidth(28), |
| | | Radius = (uint)Application.GetRealWidth(14), |
| | | BackgroundColor = 0xff1B2D4D, |
| | | SelectedBackgroundColor = MusicColor.SelectedColor, |
| | | Name = "确定" |
| | | }; |
| | | |
| | | public void AddView(FrameLayout layout) |
| | | { |
| | | layout.AddChidren(this); |
| | | this.AddChidren(btnTop); |
| | | this.AddChidren(btnTopClick); |
| | | this.AddChidren(btnBottom); |
| | | this.AddChidren(btnBottomClick); |
| | | this.AddChidren(btnLeft); |
| | | this.AddChidren(btnLeftClick); |
| | | this.AddChidren(btnRight); |
| | | this.AddChidren(btnRightClick); |
| | | this.AddChidren(btnOkbj); |
| | | this.AddChidren(btnOk); |
| | | |
| | | |
| | | |
| | | layout.AddChidren(this); |
| | | //btnBottom.Y = btnOkbj.Bottom + Application.GetRealWidth(16); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 上 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | public void SetTopClickListener(Action<KeypadEntity> action) |
| | | { |
| | | EventHandler<MouseEventArgs> UpClick = (sender, e) => |
| | | { |
| | | KeypadEntity keypadEntity = new KeypadEntity(); |
| | | keypadEntity.name = btnTop.Name; |
| | | keypadEntity.keypad = "key_up"; |
| | | action?.Invoke(keypadEntity); |
| | | SetButtonIsSelected(btnTop); |
| | | }; |
| | | btnTop.MouseUpEventHandler += UpClick; |
| | | btnTopClick.MouseUpEventHandler += UpClick; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 下 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | public void SetBottomClickListener(Action<KeypadEntity> action) |
| | | { |
| | | EventHandler<MouseEventArgs> UpClick = (sender, e) => |
| | | { |
| | | KeypadEntity keypadEntity = new KeypadEntity(); |
| | | keypadEntity.name = btnBottom.Name; |
| | | keypadEntity.keypad = "key_down"; |
| | | action?.Invoke(keypadEntity); |
| | | SetButtonIsSelected(btnBottom); |
| | | }; |
| | | btnBottom.MouseUpEventHandler += UpClick; |
| | | btnBottomClick.MouseUpEventHandler += UpClick; |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 左 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | public void SetLeftClickListener(Action<KeypadEntity> action) |
| | | { |
| | | EventHandler<MouseEventArgs> UpClick = (sender, e) => |
| | | { |
| | | KeypadEntity keypadEntity = new KeypadEntity(); |
| | | keypadEntity.name = btnLeft.Name; |
| | | keypadEntity.keypad = "key_left"; |
| | | action?.Invoke(keypadEntity); |
| | | SetButtonIsSelected(btnLeft); |
| | | }; |
| | | btnLeft.MouseUpEventHandler += UpClick; |
| | | btnLeftClick.MouseUpEventHandler += UpClick; |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 右 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | public void SetRightClickListener(Action<KeypadEntity> action) |
| | | { |
| | | EventHandler<MouseEventArgs> UpClick = (sender, e) => |
| | | { |
| | | KeypadEntity keypadEntity = new KeypadEntity(); |
| | | keypadEntity.name = btnRight.Name; |
| | | keypadEntity.keypad = "key_right"; |
| | | action?.Invoke(keypadEntity); |
| | | SetButtonIsSelected(btnRight); |
| | | }; |
| | | btnRight.MouseUpEventHandler += UpClick; |
| | | btnRightClick.MouseUpEventHandler += UpClick; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ok |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | public void SetOkClickListener(Action<KeypadEntity> action) |
| | | { |
| | | EventHandler<MouseEventArgs> UpClick = (sender, e) => |
| | | { |
| | | KeypadEntity keypadEntity = new KeypadEntity(); |
| | | keypadEntity.name = btnOk.Name; |
| | | keypadEntity.keypad = "key_ok"; |
| | | action?.Invoke(keypadEntity); |
| | | SetButtonIsSelected(btnOk); |
| | | }; |
| | | btnOk.MouseUpEventHandler += UpClick; |
| | | |
| | | } |
| | | |
| | | } |
| | | } |