| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.UI.Music; |
| | | using HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView; |
| | | using Shared; |
| | | using static HDL_ON.UI.UI2.FuntionControlView.Aks.AksPage; |
| | | |
| | | namespace HDL_ON.UI.UI2.FuntionControlView.Aks |
| | | { |
| | | /// <summary> |
| | | /// 播放器界面 |
| | | /// </summary> |
| | | public class AksMusicPage : BaseFramLayout |
| | | { |
| | | public AksMusicPage() |
| | | { |
| | | } |
| | | |
| | | public Action<IntType> action; |
| | | CornerFramLayout cornerFram; |
| | | TypeSingleFramLayout typeSingleFramLayout; |
| | | MenuFramLayout menuFram; |
| | | TypeMultiFramLayout typeMultiFramLayout; |
| | | |
| | | public void Show() |
| | | { |
| | | //初始化UI |
| | | this.InitUI(); |
| | | //初始化事件 |
| | | this.EventListener(); |
| | | //读取数据 |
| | | this.ReadData(); |
| | | |
| | | } |
| | | |
| | | private void ReadData() |
| | | { |
| | | |
| | | } |
| | | |
| | | private void EventListener() |
| | | { |
| | | cornerFram.LoadButtonPage(4, (value) => |
| | | { |
| | | Console.WriteLine("1"); |
| | | }); |
| | | |
| | | typeSingleFramLayout.SetClickListener((f) => |
| | | { |
| | | Console.WriteLine("2"); |
| | | }); |
| | | |
| | | menuFram.SetTopClickListener((b) => |
| | | { |
| | | Console.WriteLine("5"); |
| | | }); |
| | | menuFram.SetBottomClickListener((b) => |
| | | { |
| | | Console.WriteLine("6"); |
| | | }); |
| | | menuFram.SetLeftClickListener((b) => |
| | | { |
| | | Console.WriteLine("7"); |
| | | }); |
| | | menuFram.SetRightClickListener((b) => |
| | | { |
| | | Console.WriteLine("8"); |
| | | }); |
| | | menuFram.SetOkClickListener((b) => |
| | | { |
| | | Console.WriteLine("9"); |
| | | }); |
| | | |
| | | typeMultiFramLayout.SetLeftFlClickListener((f) => |
| | | { |
| | | Console.WriteLine("3"); |
| | | }); |
| | | |
| | | typeMultiFramLayout.SetRightFlClickListener((f) => |
| | | { |
| | | Console.WriteLine("4"); |
| | | action?.Invoke(IntType.Player); |
| | | }); |
| | | |
| | | } |
| | | |
| | | private void InitUI() |
| | | { |
| | | this.BackgroundColor = MusicColor.ViewColor; |
| | | Button btnTitle = new Button |
| | |
| | | }; |
| | | this.AddChidren(btnTitle); |
| | | |
| | | CornerFramLayout cornerFram = new CornerFramLayout(343, 452); |
| | | cornerFram = new CornerFramLayout(343, 452); |
| | | cornerFram.X = Application.GetRealWidth(16); |
| | | cornerFram.Y = btnTitle.Bottom + Application.GetRealHeight(16); |
| | | this.AddChidren(cornerFram); |
| | | cornerFram.SetList(cornerFram.GetTestList(17)); |
| | | cornerFram.SetMargin(16, 0, 16, 0); |
| | | cornerFram.LoadButtonPage(4, (value) => |
| | | { |
| | | |
| | | }); |
| | | |
| | | FrameLayout payerFramLayout = new FrameLayout(); |
| | | payerFramLayout.Width = Application.GetRealWidth(343); |
| | | payerFramLayout.Height = Application.GetRealHeight(364); |
| | | payerFramLayout.Y = cornerFram.Bottom + Application.GetRealHeight(16); |
| | | payerFramLayout.X = Application.GetRealWidth(16); |
| | | payerFramLayout.BackgroundColor = MusicColor.WhiteColor; |
| | | payerFramLayout.Radius = (uint)Application.GetRealHeight(17); |
| | | this.AddChidren(payerFramLayout); |
| | | |
| | | |
| | | FrameLayout singleFramLayout = new FrameLayout |
| | | { |
| | | BackgroundColor = MusicColor.ViewColor, |
| | | Y = Application.GetRealHeight(24), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(101), |
| | | Height = Application.GetRealHeight(40), |
| | | Radius = (uint)Application.GetRealHeight(20), |
| | | }; |
| | | payerFramLayout.AddChidren(singleFramLayout); |
| | | CornerFramLayout cornerBottomFram = new CornerFramLayout(343, 364); |
| | | cornerBottomFram.X = Application.GetRealWidth(16); |
| | | cornerBottomFram.Y = cornerFram.Bottom + Application.GetRealHeight(16); |
| | | cornerBottomFram.BackgroundColor = MusicColor.WhiteColor; |
| | | cornerBottomFram.Radius = (uint)Application.GetRealHeight(17); |
| | | this.AddChidren(cornerBottomFram); |
| | | |
| | | Button btnLeftImage = new Button |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(16), |
| | | UnSelectedImagePath = "AksIcon/yingku.png", |
| | | Gravity = Gravity.CenterVertical, |
| | | Name = "btnLeftImage", |
| | | }; |
| | | singleFramLayout.AddChidren(btnLeftImage); |
| | | Button btnName = new Button |
| | | { |
| | | X = btnLeftImage.Right + Application.GetRealWidth(4), |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealHeight(23), |
| | | TextID = StringId.yingku, |
| | | TextSize = TextSize.Text16, |
| | | TextColor = MusicColor.TextColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | Gravity = Gravity.CenterVertical, |
| | | IsMoreLines = true, |
| | | Name = "btnName", |
| | | }; |
| | | singleFramLayout.AddChidren(btnName); |
| | | Button btnRightImage = new Button |
| | | { |
| | | X = btnName.Right + Application.GetRealWidth(8), |
| | | Width = Application.GetRealWidth(5), |
| | | Height = Application.GetRealWidth(8), |
| | | UnSelectedImagePath = "AksIcon/yingkunext.png", |
| | | Gravity = Gravity.CenterVertical, |
| | | Name = "btnRightImage", |
| | | }; |
| | | singleFramLayout.AddChidren(btnRightImage); |
| | | typeSingleFramLayout = new TypeSingleFramLayout(); |
| | | typeSingleFramLayout.singleFramLayout.Y = Application.GetRealHeight(24); |
| | | typeSingleFramLayout.AddView(cornerBottomFram); |
| | | |
| | | menuFram = new MenuFramLayout(); |
| | | menuFram.Y = typeSingleFramLayout.singleFramLayout.Bottom + Application.GetRealHeight(32); |
| | | menuFram.AddView(cornerBottomFram); |
| | | |
| | | typeMultiFramLayout = new TypeMultiFramLayout(); |
| | | typeMultiFramLayout.multiFramLayout.Y = menuFram.Bottom + Application.GetRealHeight(32); |
| | | typeMultiFramLayout.AddView(cornerBottomFram); |
| | | |
| | | |
| | | MenuFramLayout menuFram = new MenuFramLayout |
| | | { |
| | | Y = singleFramLayout.Bottom + Application.GetRealHeight(32), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | }; |
| | | menuFram.AddView(payerFramLayout); |
| | | |
| | | |
| | | FrameLayout multiFramLayout = new FrameLayout |
| | | { |
| | | BackgroundColor = MusicColor.ViewColor, |
| | | X=Application.GetRealWidth(16), |
| | | Y = menuFram.Bottom+Application.GetRealHeight(32), |
| | | Width = Application.GetRealWidth(311), |
| | | Height = Application.GetRealHeight(40), |
| | | Radius = (uint)Application.GetRealHeight(20), |
| | | }; |
| | | payerFramLayout.AddChidren(multiFramLayout); |
| | | |
| | | |
| | | FrameLayout leftFramLayout = new FrameLayout |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(139), |
| | | Height = Application.GetRealHeight(23), |
| | | Radius = (uint)Application.GetRealHeight(20), |
| | | |
| | | }; |
| | | multiFramLayout.AddChidren(leftFramLayout); |
| | | |
| | | Button btnBottonLeftImage = new Button |
| | | { |
| | | Width = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(16), |
| | | UnSelectedImagePath = "AksIcon/shixuqi.png", |
| | | Gravity = Gravity.CenterVertical, |
| | | Name = "btnBottonLeftImage", |
| | | }; |
| | | leftFramLayout.AddChidren(btnBottonLeftImage); |
| | | Button btnBottonName = new Button |
| | | { |
| | | X = btnBottonLeftImage.Right + Application.GetRealWidth(4), |
| | | Width = Application.GetRealWidth(100), |
| | | Height = Application.GetRealHeight(23), |
| | | TextID = StringId.shixuqi, |
| | | TextSize = TextSize.Text16, |
| | | TextColor = MusicColor.TextColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Gravity = Gravity.CenterVertical, |
| | | IsMoreLines = true, |
| | | Name = "btnName", |
| | | }; |
| | | leftFramLayout.AddChidren(btnBottonName); |
| | | |
| | | |
| | | FrameLayout lineFramLayout = new FrameLayout |
| | | { |
| | | BackgroundColor = MusicColor.TextColor, |
| | | X = leftFramLayout.Right, |
| | | Y =Application.GetRealHeight(10), |
| | | Width = Application.GetRealWidth(1), |
| | | Height = Application.GetRealHeight(20), |
| | | }; |
| | | multiFramLayout.AddChidren(lineFramLayout); |
| | | |
| | | |
| | | FrameLayout rightFramLayout = new FrameLayout |
| | | { |
| | | X =lineFramLayout.Right, |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(138), |
| | | Height = Application.GetRealHeight(23), |
| | | |
| | | }; |
| | | multiFramLayout.AddChidren(rightFramLayout); |
| | | |
| | | Button btnBottonRightImage = new Button |
| | | { |
| | | Width = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(16), |
| | | UnSelectedImagePath = "AksIcon/xuanze.png", |
| | | Gravity = Gravity.CenterRight, |
| | | Name = "btnBottonLeftImage", |
| | | }; |
| | | rightFramLayout.AddChidren(btnBottonRightImage); |
| | | |
| | | Button btnBottonRightName = new Button |
| | | { |
| | | X = btnBottonLeftImage.Right + Application.GetRealWidth(4), |
| | | Width = Application.GetRealWidth(100), |
| | | Height = Application.GetRealHeight(23), |
| | | TextID = StringId.bofangqi, |
| | | TextSize = TextSize.Text16, |
| | | TextColor = MusicColor.TextColor, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | Gravity = Gravity.CenterVertical, |
| | | IsMoreLines = true, |
| | | Name = "btnName", |
| | | }; |
| | | rightFramLayout.AddChidren(btnBottonRightName); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //PayerFramLayout payerFramLayout = new PayerFramLayout(343, 364); |
| | | //payerFramLayout.Y = cornerFram.Bottom + Application.GetRealHeight(16); |
| | | //payerFramLayout.X = Application.GetRealWidth(16); |
| | | //payerFramLayout.LoadPage(); |
| | | //this.AddChidren(payerFramLayout); |
| | | |
| | | this.AdjustRealHeight(20); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | using HDL_ON.DriverLayer; |
| | | using HDL_ON.UI.Music; |
| | | using HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock; |
| | | using HDL_ON.UI.UI2.Intelligence.Automation; |
| | | using System.Linq; |
| | | |
| | | namespace HDL_ON.UI.UI2.FuntionControlView.Aks |
| | | { |
| | | public class AksPage : FrameLayout |
| | |
| | | /// 删除设备后需要更新界面的回调 |
| | | /// </summary> |
| | | public Action action; |
| | | |
| | | public IntType currnetIntType; |
| | | |
| | | public VerticalScrolViewLayout vv; |
| | | #endregion |
| | |
| | | Height = Application.GetRealHeight(H_W.H - H_W.T_Height), |
| | | }; |
| | | this.AddChidren(vv); |
| | | AksMusicPage aksMusicPage = new AksMusicPage(); |
| | | this.vv.AddChidren(aksMusicPage); |
| | | aksMusicPage.Show(); |
| | | |
| | | //进来默认播放器界面 |
| | | this.SwitchUI(IntType.Player); |
| | | } |
| | | /// <summary> |
| | | /// 注册事件 |
| | |
| | | ////刷新显示 |
| | | this.btnDeviceName.Text = this.device.name; |
| | | this.btnRoomName.Text = this.device.GetRoomListName(); |
| | | this.btnCurrDeviceName.Text = this.device.name; |
| | | this.btnCurrDeviceRoom.Text = this.device.GetRoomListName(); |
| | | //this.btnCurrDeviceName.Text = this.device.name; |
| | | //this.btnCurrDeviceRoom.Text = this.device.GetRoomListName(); |
| | | //this.CalculatedPosition();//重新计算宽度 |
| | | |
| | | }); |
| | |
| | | } |
| | | }); |
| | | } |
| | | /// <summary> |
| | | /// 切换界面 |
| | | ///1 = 播放器 |
| | | ///2 = 功放 |
| | | ///3 = 电视 |
| | | ///4 = 机顶盒 |
| | | ///5 = 投影仪 |
| | | ///6 = 万能遥控器 |
| | | /// </summary> |
| | | private void SwitchUI(IntType type) |
| | | { |
| | | if (vv != null) |
| | | { |
| | | vv.RemoveAll(); |
| | | } |
| | | if (this.currnetIntType == type) |
| | | { |
| | | return; |
| | | } |
| | | if (IntType.none == type) |
| | | { |
| | | return; |
| | | } |
| | | this.currnetIntType = type; |
| | | switch (type) |
| | | { |
| | | case IntType.Player: |
| | | { |
| | | AksMusicPage aksMusicPage = new AksMusicPage(); |
| | | this.vv.AddChidren(aksMusicPage); |
| | | aksMusicPage.Show(); |
| | | aksMusicPage.action += (type) => |
| | | { |
| | | SelectedType(); |
| | | }; |
| | | } |
| | | break; |
| | | case IntType.HiFi: { } break; |
| | | case IntType.TV: { } break; |
| | | case IntType.STB: { } break; |
| | | case IntType.Projector: { } break; |
| | | case IntType.Control: { } break; |
| | | |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 选中类型 |
| | | ///1 = 播放器 |
| | | ///2 = 功放 |
| | | ///3 = 电视 |
| | | ///4 = 机顶盒 |
| | | ///5 = 投影仪 |
| | | ///6 = 万能遥控器 |
| | | /// </summary> |
| | | /// <param name="button">显示文本</param> |
| | | private void SelectedType() |
| | | { |
| | | var deviceTypeList = GetTypeDictionary().Values.ToList(); |
| | | ///之前的状态文本 |
| | | string currCondition = Language.StringByID(StringId.bofangqi); |
| | | PublicInterface conditionView = new PublicInterface(); |
| | | conditionView.SingleSelectionShow(this, deviceTypeList, "设备选择", currCondition |
| | | , (stateValue) => |
| | | { |
| | | //界面显示选中值 |
| | | //button.Text = stateValue; |
| | | var intType = this.GetKeyIntType(stateValue); |
| | | this.SwitchUI(intType); |
| | | |
| | | }); |
| | | } |
| | | |
| | | public enum IntType |
| | | { |
| | | /// <summary> |
| | | /// 没有 |
| | | /// </summary> |
| | | none = 0, |
| | | /// <summary> |
| | | /// 播放器 |
| | | /// </summary> |
| | | Player = 1, |
| | | /// <summary> |
| | | /// 功放 |
| | | /// </summary> |
| | | HiFi = 2, |
| | | /// <summary> |
| | | /// 电视 |
| | | /// </summary> |
| | | TV = 3, |
| | | /// <summary> |
| | | /// 机顶盒 |
| | | /// </summary> |
| | | STB = 4, |
| | | /// <summary> |
| | | /// 投影仪 |
| | | /// </summary> |
| | | Projector = 5, |
| | | /// <summary> |
| | | /// 万能遥控器 |
| | | /// </summary> |
| | | Control = 6, |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private Dictionary<IntType, string> GetTypeDictionary() |
| | | { |
| | | var dic = new Dictionary<IntType, string>(); |
| | | dic.Add(IntType.Player, Language.StringByID(StringId.bofangqi)); |
| | | dic.Add(IntType.HiFi, Language.StringByID(StringId.gongfan)); |
| | | dic.Add(IntType.TV, Language.StringByID(StringId.dianshi)); |
| | | dic.Add(IntType.STB, Language.StringByID(StringId.jidinghe)); |
| | | dic.Add(IntType.Projector, Language.StringByID(StringId.touyingyi)); |
| | | dic.Add(IntType.Control, Language.StringByID(StringId.xuniyaokongqi)); |
| | | return dic; |
| | | } |
| | | private IntType GetKeyIntType(string value) |
| | | { |
| | | var dic = this.GetTypeDictionary(); |
| | | foreach (var d in dic) |
| | | { |
| | | if (d.Value == value) |
| | | { |
| | | return d.Key; |
| | | } |
| | | } |
| | | return IntType.none; |
| | | } |
| | | private string GetValueString(IntType key) |
| | | { |
| | | var dic = this.GetTypeDictionary(); |
| | | foreach (var d in dic) |
| | | { |
| | | if (d.Key == key) |
| | | { |
| | | return d.Value; |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | return bottomHeight; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | EventHandler<MouseEventArgs> UpClick = (sender, e) => |
| | | { |
| | | this.BackgroundColor = 0x00000000; |
| | | action?.Invoke(this, btnImage, btnName); |
| | | |
| | | //弹起来还原背景颜色 |
| | | }; |
| | | this.MouseUpEventHandler += UpClick; |
| | |
| | | |
| | | //EventHandler<MouseEventArgs> MoveClick = (sender, e) => |
| | | //{ |
| | | // Console.WriteLine("移动事件====="); |
| | | // this.BackgroundColor = 0x00000000; |
| | | // action?.Invoke(this, btnImage, btnName); |
| | | // //弹起来还原背景颜色 |
| | | //}; |
| | | //this.MouseMoveEventHandler += MoveClick; |
| | |
| | | { |
| | | //按下去改变背景颜色 |
| | | this.BackgroundColor = 0xff454635; |
| | | action?.Invoke(this, btnImage, btnName); |
| | | }; |
| | | this.MouseDownEventHandler += DownClick; |
| | | btnImage.MouseDownEventHandler += DownClick; |
| | |
| | | { |
| | | public class MenuFramLayout : BaseFramLayout |
| | | { |
| | | |
| | | private uint UpBackgroundColor = 0x00000000; |
| | | private uint DownBackgroundColor = 0xff454635; |
| | | public const int widthFrameLayout = 180; |
| | | public const int heightFrameLayout = 180; |
| | | public const int cornerValue = 90; |
| | |
| | | this.Height = Application.GetMinRealAverage(height); |
| | | this.Radius = (uint)Application.GetRealHeight(cornerValue); |
| | | this.BackgroundColor = MusicColor.ViewColor; |
| | | this.Gravity = Gravity.CenterHorizontal; |
| | | } |
| | | Button btnTop = new Button |
| | | { |
| | |
| | | |
| | | public void AddView(FrameLayout layout) |
| | | { |
| | | layout.AddChidren(this); |
| | | this.AddChidren(btnTop); |
| | | this.AddChidren(btnBottom); |
| | | this.AddChidren(btnLeft); |
| | | this.AddChidren(btnRight); |
| | | this.AddChidren(btnOkbj); |
| | | this.AddChidren(btnOk); |
| | | |
| | | layout.AddChidren(this); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 上 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | public void SetTopClickListener(Action<Button> action) |
| | | { |
| | | EventHandler<MouseEventArgs> UpClick = (sender, e) => |
| | | { |
| | | //btnTop.BackgroundColor = this.UpBackgroundColor; |
| | | btnTop.IsSelected = false; |
| | | action?.Invoke(btnTop); |
| | | //弹起来还原背景颜色 |
| | | }; |
| | | btnTop.MouseUpEventHandler += UpClick; |
| | | |
| | | |
| | | EventHandler<MouseEventArgs> DownClick = (sender, e) => |
| | | { |
| | | //按下去改变背景颜色 |
| | | btnTop.BackgroundColor = this.DownBackgroundColor; |
| | | }; |
| | | btnTop.MouseDownEventHandler += DownClick; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 下 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | public void SetBottomClickListener(Action<Button> action) |
| | | { |
| | | EventHandler<MouseEventArgs> UpClick = (sender, e) => |
| | | { |
| | | //btnBottom.BackgroundColor = this.UpBackgroundColor; |
| | | btnBottom.IsSelected = false; |
| | | action?.Invoke(btnBottom); |
| | | //弹起来还原背景颜色 |
| | | }; |
| | | btnBottom.MouseUpEventHandler += UpClick; |
| | | |
| | | |
| | | EventHandler<MouseEventArgs> DownClick = (sender, e) => |
| | | { |
| | | //按下去改变背景颜色 |
| | | btnBottom.BackgroundColor = this.DownBackgroundColor; |
| | | }; |
| | | btnBottom.MouseDownEventHandler += DownClick; |
| | | } |
| | | /// <summary> |
| | | /// 左 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | public void SetLeftClickListener(Action<Button> action) |
| | | { |
| | | EventHandler<MouseEventArgs> UpClick = (sender, e) => |
| | | { |
| | | //btnLeft.BackgroundColor = this.UpBackgroundColor; |
| | | btnLeft.IsSelected = false; |
| | | action?.Invoke(btnLeft); |
| | | //弹起来还原背景颜色 |
| | | }; |
| | | btnLeft.MouseUpEventHandler += UpClick; |
| | | |
| | | |
| | | EventHandler<MouseEventArgs> DownClick = (sender, e) => |
| | | { |
| | | //按下去改变背景颜色 |
| | | btnLeft.BackgroundColor = this.DownBackgroundColor; |
| | | }; |
| | | btnLeft.MouseDownEventHandler += DownClick; |
| | | } |
| | | /// <summary> |
| | | /// 右 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | public void SetRightClickListener(Action<Button> action) |
| | | { |
| | | EventHandler<MouseEventArgs> UpClick = (sender, e) => |
| | | { |
| | | //btnRight.BackgroundColor = this.UpBackgroundColor; |
| | | btnRight.IsSelected = false; |
| | | action?.Invoke(btnRight); |
| | | //弹起来还原背景颜色 |
| | | }; |
| | | btnRight.MouseUpEventHandler += UpClick; |
| | | |
| | | |
| | | EventHandler<MouseEventArgs> DownClick = (sender, e) => |
| | | { |
| | | //按下去改变背景颜色 |
| | | btnRight.BackgroundColor = this.DownBackgroundColor; |
| | | }; |
| | | btnRight.MouseDownEventHandler += DownClick; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// ok |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | public void SetOkClickListener(Action<Button> action) |
| | | { |
| | | EventHandler<MouseEventArgs> UpClick = (sender, e) => |
| | | { |
| | | btnOk.BackgroundColor = MusicColor.SelectedColor;// this.UpBackgroundColor; |
| | | action?.Invoke(btnOk); |
| | | //弹起来还原背景颜色 |
| | | }; |
| | | btnOk.MouseUpEventHandler += UpClick; |
| | | |
| | | |
| | | EventHandler<MouseEventArgs> DownClick = (sender, e) => |
| | | { |
| | | //按下去改变背景颜色 |
| | | btnOk.BackgroundColor = this.DownBackgroundColor; |
| | | }; |
| | | btnOk.MouseDownEventHandler += DownClick; |
| | | } |
| | | |
| | | public void SetClickUpBackgroundColor(uint backgroundColor) |
| | | { |
| | | this.UpBackgroundColor = backgroundColor; |
| | | |
| | | } |
| | | |
| | | public void SetClickDownBackgroundColor(uint backgroundColor) |
| | | { |
| | | this.DownBackgroundColor = backgroundColor; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | { |
| | | public class PayerFramLayout : BaseFramLayout |
| | | { |
| | | public PayerFramLayout(int width, int height) |
| | | public FrameLayout fLayout = new FrameLayout |
| | | { |
| | | this.BackgroundColor = MusicColor.WhiteColor; |
| | | this.Width = Application.GetRealWidth(width); |
| | | this.Height = Application.GetRealHeight(height); |
| | | this.Radius = (uint)Application.GetRealHeight(17); |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(364), |
| | | X = Application.GetRealWidth(16), |
| | | BackgroundColor = MusicColor.WhiteColor, |
| | | Radius = (uint)Application.GetRealHeight(17), |
| | | }; |
| | | |
| | | TypeSingleFramLayout typeSingleFramLayout = new TypeSingleFramLayout(); |
| | | |
| | | /// <summary> |
| | | /// 菜单容器(上,下,左,右,ok) |
| | | /// </summary> |
| | | public MenuFramLayout menuFram = new MenuFramLayout(); |
| | | |
| | | public TypeMultiFramLayout typeMultiFramLayout = new TypeMultiFramLayout(); |
| | | |
| | | public void AddView(FrameLayout layout) |
| | | { |
| | | layout.AddChidren(fLayout); |
| | | typeSingleFramLayout.singleFramLayout.Y = Application.GetRealHeight(24); |
| | | typeSingleFramLayout.AddView(fLayout); |
| | | menuFram.Y = typeSingleFramLayout.singleFramLayout.Bottom + Application.GetRealHeight(32); |
| | | menuFram.AddView(fLayout); |
| | | typeMultiFramLayout.multiFramLayout.Y = menuFram.Bottom + Application.GetRealHeight(32); |
| | | typeMultiFramLayout.AddView(fLayout); |
| | | |
| | | } |
| | | |
| | | |
| | | public void LoadPage() |
| | | /// <summary> |
| | | /// 单个容器事件 |
| | | /// </summary> |
| | | /// <param name="action">回调(第一个是父类对象</param> |
| | | public void SetSinglClickListener(Action<FrameLayout> action) |
| | | { |
| | | TypeSingleFramLayout singleFramLayout = new TypeSingleFramLayout(101, 40); |
| | | this.AddChidren(singleFramLayout); |
| | | singleFramLayout.Y = Application.GetRealHeight(24); |
| | | singleFramLayout.Gravity = Gravity.CenterHorizontal; |
| | | singleFramLayout.AddBtnLeftImage(); |
| | | singleFramLayout.AddBtnName(); |
| | | singleFramLayout.AddBtnRightImage(); |
| | | |
| | | |
| | | |
| | | MenuFramLayout menuFramLayout = new MenuFramLayout(); |
| | | menuFramLayout.Y = singleFramLayout.Bottom + Application.GetRealHeight(32); |
| | | menuFramLayout.Gravity = Gravity.CenterHorizontal; |
| | | menuFramLayout.AddView(this); |
| | | |
| | | |
| | | |
| | | typeSingleFramLayout.SetClickListener(action); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 左边容器事件 |
| | | /// </summary> |
| | | /// <param name="action">回调(第一个是父类对象</param> |
| | | public void SetLeftFlClickListener(Action<FrameLayout> action) |
| | | { |
| | | |
| | | typeMultiFramLayout.SetLeftFlClickListener(action); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 右边容器事件 |
| | | /// </summary> |
| | | /// <param name="action">回调(第一个是父类对象</param> |
| | | public void SetRightFlClickListener(Action<FrameLayout> action) |
| | | { |
| | | typeMultiFramLayout.SetRightFlClickListener(action); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | private uint UpBackgroundColor = 0x00000000; |
| | | private uint DownBackgroundColor = 0xff454635; |
| | | public TypeMultiFramLayout() |
| | | |
| | | /// <summary> |
| | | /// 多个类型容器 |
| | | /// </summary> |
| | | public FrameLayout multiFramLayout = new FrameLayout |
| | | { |
| | | this.BackgroundColor = MusicColor.ViewColor; |
| | | this.Height = Application.GetRealHeight(40); |
| | | this.Radius = (uint)Application.GetRealHeight(20); |
| | | BackgroundColor = MusicColor.ViewColor, |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(311), |
| | | Height = Application.GetRealHeight(40), |
| | | Radius = (uint)Application.GetRealHeight(20), |
| | | }; |
| | | |
| | | } |
| | | |
| | | Button btnLeftImage = new Button |
| | | |
| | | public FrameLayout leftFramLayout = new FrameLayout |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(139), |
| | | Height = Application.GetRealHeight(23), |
| | | Radius = (uint)Application.GetRealHeight(20), |
| | | |
| | | }; |
| | | |
| | | |
| | | public Button btnBottonLeftImage = new Button |
| | | { |
| | | Width = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(16), |
| | | UnSelectedImagePath = "AksIcon/yingku.png", |
| | | UnSelectedImagePath = "AksIcon/shixuqi.png", |
| | | Gravity = Gravity.CenterVertical, |
| | | Name = "btnLeftImage", |
| | | Name = "btnBottonLeftImage", |
| | | }; |
| | | Button btnName1 = new Button |
| | | |
| | | public Button btnBottonName = new Button |
| | | { |
| | | Width = Application.GetRealWidth(32), |
| | | Width = Application.GetRealWidth(100), |
| | | Height = Application.GetRealHeight(23), |
| | | TextID = StringId.shixuqi, |
| | | TextSize = TextSize.Text16, |
| | | TextColor = MusicColor.TextColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Gravity = Gravity.CenterVertical, |
| | | IsMoreLines = true, |
| | | Name = "btnName", |
| | | }; |
| | | |
| | | Button btnRightImage = new Button |
| | | |
| | | |
| | | public FrameLayout lineFramLayout = new FrameLayout |
| | | { |
| | | BackgroundColor = MusicColor.TextColor, |
| | | Y = Application.GetRealHeight(10), |
| | | Width = Application.GetRealWidth(1), |
| | | Height = Application.GetRealHeight(20), |
| | | }; |
| | | |
| | | |
| | | |
| | | public FrameLayout rightFramLayout = new FrameLayout |
| | | { |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(138), |
| | | Height = Application.GetRealHeight(23), |
| | | Radius = (uint)Application.GetRealHeight(20), |
| | | |
| | | }; |
| | | |
| | | |
| | | public Button btnBottonRightImage = new Button |
| | | { |
| | | Width = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(16), |
| | | UnSelectedImagePath = "AksIcon/yingkunext.png", |
| | | Gravity = Gravity.CenterVertical, |
| | | Name = "btnRightImage", |
| | | UnSelectedImagePath = "AksIcon/xuanze.png", |
| | | Gravity = Gravity.CenterRight, |
| | | }; |
| | | |
| | | |
| | | public void AddBtnLeftImage() |
| | | public Button btnBottonRightName = new Button |
| | | { |
| | | this.AddChidren(btnLeftImage); |
| | | Width = Application.GetRealWidth(100), |
| | | Height = Application.GetRealHeight(23), |
| | | TextID = StringId.bofangqi, |
| | | TextSize = TextSize.Text16, |
| | | TextColor = MusicColor.TextColor, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | Gravity = Gravity.CenterVertical, |
| | | IsMoreLines = true, |
| | | }; |
| | | |
| | | |
| | | public void AddView(FrameLayout layout) |
| | | { |
| | | layout.AddChidren(multiFramLayout); |
| | | multiFramLayout.AddChidren(leftFramLayout); |
| | | leftFramLayout.AddChidren(btnBottonLeftImage); |
| | | leftFramLayout.AddChidren(btnBottonName); |
| | | multiFramLayout.AddChidren(lineFramLayout); |
| | | multiFramLayout.AddChidren(rightFramLayout); |
| | | rightFramLayout.AddChidren(btnBottonRightImage); |
| | | rightFramLayout.AddChidren(btnBottonRightName); |
| | | btnBottonName.X = btnBottonLeftImage.Right + Application.GetRealWidth(4); |
| | | lineFramLayout.X = leftFramLayout.Right; |
| | | rightFramLayout.X = lineFramLayout.Right; |
| | | btnBottonRightName.X = btnBottonLeftImage.Right + Application.GetRealWidth(4); |
| | | } |
| | | |
| | | public void AddBtnName(int gap = 4) |
| | | { |
| | | if (this.IsAddBtn(btnLeftImage)) |
| | | { |
| | | btnName1.X = btnLeftImage.Right + Application.GetRealWidth(gap); |
| | | } |
| | | |
| | | //if (btnName.GetTextWidth() < btnName.Width) |
| | | //{ |
| | | // btnName.Width = btnName.GetTextWidth(); |
| | | //} |
| | | this.AddChidren(btnName1); |
| | | } |
| | | |
| | | public void AddBtnRightImage(int gap = 8) |
| | | { |
| | | |
| | | if (this.IsAddBtn(btnName1)) |
| | | { |
| | | btnRightImage.X = btnName1.Right + Application.GetRealWidth(gap); |
| | | if (gap == 8) |
| | | { |
| | | btnRightImage.Width = Application.GetRealWidth(5); |
| | | btnRightImage.Height = Application.GetRealHeight(8); |
| | | } |
| | | |
| | | } |
| | | this.AddChidren(btnRightImage); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public Button GetBtnLeftImage() |
| | | { |
| | | return btnLeftImage; |
| | | } |
| | | |
| | | public Button GetBtnName() |
| | | { |
| | | return btnName1; |
| | | } |
| | | |
| | | public Button GetBtnRightImage() |
| | | { |
| | | return btnRightImage; |
| | | } |
| | | |
| | | public void SetClickUpBackgroundColor(uint backgroundColor) |
| | | { |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 事件监听方法 |
| | | /// 序时器类型容器 |
| | | /// </summary> |
| | | /// <param name="action">回调(第一个是父类对象;第二个是图标对象;第三个是状态对象</param> |
| | | public void SetClickListener(Action<FrameLayout, Button, Button, Button> action) |
| | | /// <param name="action">回调(第一个是父类对象</param> |
| | | public void SetLeftFlClickListener(Action<FrameLayout> action) |
| | | { |
| | | EventHandler<MouseEventArgs> UpClick = (sender, e) => |
| | | { |
| | | this.BackgroundColor = this.UpBackgroundColor; |
| | | action?.Invoke(this, btnLeftImage, btnName1, btnRightImage); |
| | | leftFramLayout.BackgroundColor = this.UpBackgroundColor; |
| | | |
| | | //弹起来还原背景颜色 |
| | | }; |
| | | this.MouseUpEventHandler += UpClick; |
| | | btnLeftImage.MouseUpEventHandler += UpClick; |
| | | btnName1.MouseUpEventHandler += UpClick; |
| | | btnRightImage.MouseUpEventHandler += UpClick; |
| | | leftFramLayout.MouseUpEventHandler += UpClick; |
| | | btnBottonLeftImage.MouseUpEventHandler += UpClick; |
| | | btnBottonName.MouseUpEventHandler += UpClick; |
| | | |
| | | |
| | | EventHandler<MouseEventArgs> DownClick = (sender, e) => |
| | | { |
| | | //按下去改变背景颜色 |
| | | this.BackgroundColor = this.DownBackgroundColor; |
| | | leftFramLayout.BackgroundColor = this.DownBackgroundColor; |
| | | action?.Invoke(leftFramLayout); |
| | | }; |
| | | this.MouseDownEventHandler += DownClick; |
| | | btnLeftImage.MouseDownEventHandler += DownClick; |
| | | btnName1.MouseDownEventHandler += DownClick; |
| | | btnRightImage.MouseDownEventHandler += DownClick; |
| | | leftFramLayout.MouseDownEventHandler += DownClick; |
| | | btnBottonLeftImage.MouseDownEventHandler += DownClick; |
| | | btnBottonName.MouseDownEventHandler += DownClick; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 在父布局查找子控件是否存在 |
| | | /// 播放器类型容器 |
| | | /// </summary> |
| | | /// <param name="btn">查找对象</param> |
| | | /// <returns>存在为true,否则为false</returns> |
| | | private bool IsAddBtn(View btn) |
| | | /// <param name="action">回调(第一个是父类对象</param> |
| | | public void SetRightFlClickListener(Action<FrameLayout> action) |
| | | { |
| | | EventHandler<MouseEventArgs> UpClick = (sender, e) => |
| | | { |
| | | rightFramLayout.BackgroundColor = this.UpBackgroundColor; |
| | | |
| | | if (this.ChildrenCount <= 0 || btn == null) |
| | | //弹起来还原背景颜色 |
| | | }; |
| | | rightFramLayout.MouseUpEventHandler += UpClick; |
| | | btnBottonRightImage.MouseUpEventHandler += UpClick; |
| | | btnBottonRightName.MouseUpEventHandler += UpClick; |
| | | |
| | | |
| | | EventHandler<MouseEventArgs> DownClick = (sender, e) => |
| | | { |
| | | return false; |
| | | } |
| | | for (int i = 0; i < this.ChildrenCount; i++) |
| | | { |
| | | View view = this.GetChildren(i); |
| | | if (view == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (view is Button) |
| | | { |
| | | if (view.Name == btn.Name) |
| | | { |
| | | return true; |
| | | } |
| | | //按下去改变背景颜色 |
| | | rightFramLayout.BackgroundColor = this.DownBackgroundColor; |
| | | action?.Invoke(rightFramLayout); |
| | | }; |
| | | rightFramLayout.MouseDownEventHandler += DownClick; |
| | | btnBottonRightImage.MouseDownEventHandler += DownClick; |
| | | btnBottonRightName.MouseDownEventHandler += DownClick; |
| | | } |
| | | |
| | | } |
| | | return false; |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | namespace HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView |
| | | { |
| | | public class TypeSingleFramLayout : BaseFramLayout |
| | | public class TypeSingleFramLayout |
| | | { |
| | | |
| | | private uint UpBackgroundColor = 0x00000000; |
| | | private uint UpBackgroundColor = MusicColor.ViewColor; |
| | | private uint DownBackgroundColor = 0xff454635; |
| | | public TypeSingleFramLayout(int width, int height) |
| | | /// <summary> |
| | | /// 单个类型容器 |
| | | /// </summary> |
| | | public FrameLayout singleFramLayout = new FrameLayout |
| | | { |
| | | this.Width = Application.GetRealWidth(width); |
| | | this.Height = Application.GetRealHeight(height); |
| | | this.Radius = (uint)Application.GetRealHeight(20); |
| | | this.BackgroundColor = MusicColor.ViewColor; |
| | | BackgroundColor = MusicColor.ViewColor, |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(101), |
| | | Height = Application.GetRealHeight(40), |
| | | Radius = (uint)Application.GetRealHeight(20), |
| | | }; |
| | | |
| | | } |
| | | |
| | | Button btnLeftImage = new Button |
| | | public Button btnLeftImage = new Button |
| | | { |
| | | X=Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(16), |
| | |
| | | Gravity = Gravity.CenterVertical, |
| | | Name = "btnLeftImage", |
| | | }; |
| | | Button btnName = new Button |
| | | |
| | | public Button btnName = new Button |
| | | { |
| | | |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealHeight(23), |
| | | TextID=StringId.yingku, |
| | |
| | | Name = "btnName", |
| | | }; |
| | | |
| | | Button btnRightImage = new Button |
| | | public Button btnRightImage = new Button |
| | | { |
| | | Width = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(16), |
| | | |
| | | Width = Application.GetRealWidth(5), |
| | | Height = Application.GetRealWidth(8), |
| | | UnSelectedImagePath = "AksIcon/yingkunext.png", |
| | | Gravity = Gravity.CenterVertical, |
| | | Name = "btnRightImage", |
| | | }; |
| | | |
| | | |
| | | public void AddBtnLeftImage() |
| | | public void AddView(FrameLayout layout) |
| | | { |
| | | this.AddChidren(btnLeftImage); |
| | | } |
| | | |
| | | public void AddBtnName(int gap = 4) |
| | | { |
| | | this.AddChidren(btnName); |
| | | if (this.IsAddBtn(btnLeftImage)) |
| | | { |
| | | btnName.X = btnLeftImage.Right + Application.GetRealWidth(gap); |
| | | } |
| | | |
| | | //if (btnName.GetTextWidth() < btnName.Width) |
| | | //{ |
| | | // btnName.Width = btnName.GetTextWidth(); |
| | | //} |
| | | |
| | | } |
| | | |
| | | public void AddBtnRightImage(int gap = 8) |
| | | { |
| | | this.AddChidren(btnRightImage); |
| | | if (this.IsAddBtn(btnName)) |
| | | { |
| | | btnRightImage.X = btnName.Right + Application.GetRealWidth(gap); |
| | | if (gap == 8) |
| | | { |
| | | btnRightImage.Width = Application.GetRealWidth(5); |
| | | btnRightImage.Height = Application.GetRealHeight(8); |
| | | } |
| | | |
| | | } |
| | | |
| | | layout.AddChidren(singleFramLayout); |
| | | singleFramLayout.AddChidren(btnLeftImage); |
| | | singleFramLayout.AddChidren(btnName); |
| | | singleFramLayout.AddChidren(btnRightImage); |
| | | btnName.X = btnLeftImage.Right + Application.GetRealWidth(4); |
| | | btnRightImage.X = btnName.Right + Application.GetRealWidth(8); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public Button GetBtnLeftImage() |
| | | { |
| | | return btnLeftImage; |
| | | } |
| | | |
| | | public Button GetBtnName() |
| | | { |
| | | return btnName; |
| | | } |
| | | |
| | | public Button GetBtnRightImage() |
| | | { |
| | | return btnRightImage; |
| | | } |
| | | |
| | | public void SetClickUpBackgroundColor(uint backgroundColor) |
| | | { |
| | |
| | | /// <summary> |
| | | /// 事件监听方法 |
| | | /// </summary> |
| | | /// <param name="action">回调(第一个是父类对象;第二个是图标对象;第三个是状态对象</param> |
| | | public void SetClickListener(Action<FrameLayout, Button, Button, Button> action) |
| | | /// <param name="action">回调(第一个是父类对象;</param> |
| | | public void SetClickListener(Action<FrameLayout> action) |
| | | { |
| | | EventHandler<MouseEventArgs> UpClick = (sender, e) => |
| | | { |
| | | this.BackgroundColor = this.UpBackgroundColor; |
| | | action?.Invoke(this, btnLeftImage, btnName, btnRightImage); |
| | | singleFramLayout.BackgroundColor = this.UpBackgroundColor; |
| | | |
| | | //弹起来还原背景颜色 |
| | | }; |
| | | this.MouseUpEventHandler += UpClick; |
| | | singleFramLayout.MouseUpEventHandler += UpClick; |
| | | btnLeftImage.MouseUpEventHandler += UpClick; |
| | | btnName.MouseUpEventHandler += UpClick; |
| | | btnRightImage.MouseUpEventHandler += UpClick; |
| | |
| | | EventHandler<MouseEventArgs> DownClick = (sender, e) => |
| | | { |
| | | //按下去改变背景颜色 |
| | | this.BackgroundColor = this.DownBackgroundColor; |
| | | singleFramLayout.BackgroundColor = this.DownBackgroundColor; |
| | | action?.Invoke(singleFramLayout); |
| | | }; |
| | | this.MouseDownEventHandler += DownClick; |
| | | singleFramLayout.MouseDownEventHandler += DownClick; |
| | | btnLeftImage.MouseDownEventHandler += DownClick; |
| | | btnName.MouseDownEventHandler += DownClick; |
| | | btnRightImage.MouseDownEventHandler += DownClick; |
| | | } |
| | | /// <summary> |
| | | /// 在父布局查找子控件是否存在 |
| | | /// </summary> |
| | | /// <param name="btn">查找对象</param> |
| | | /// <returns>存在为true,否则为false</returns> |
| | | private bool IsAddBtn(View btn) |
| | | { |
| | | |
| | | if (this.ChildrenCount <= 0 || btn == null) |
| | | { |
| | | return false; |
| | | } |
| | | for (int i = 0; i < this.ChildrenCount; i++) |
| | | { |
| | | View view = this.GetChildren(i); |
| | | if (view == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (view is Button) |
| | | { |
| | | if (view.Name == btn.Name) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | } |
| | | return false; |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |