From f8283c8ebef3e0af8bd990c3e86cc9d010ba528e Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期二, 01 八月 2023 16:37:33 +0800 Subject: [PATCH] 2023年08月01日16:37:16 --- HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/BaseFramLayout.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeMultiFramLayout.cs | 228 ++++++----- HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs | 140 +++++++ HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ButtonFramLayout.cs | 5 HDL_ON/UI/UI2/FuntionControlView/Aks/AksMusicPage.cs | 267 +++++--------- HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeSingleFramLayout.cs | 142 ++----- HDL_ON/UI/UI2/FuntionControlView/Aks/AksPage.cs | 162 ++++++++ HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/PayerFramLayout.cs | 77 ++- 8 files changed, 599 insertions(+), 424 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/AksMusicPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/AksMusicPage.cs index a13003f..80df87b 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/AksMusicPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/AksMusicPage.cs @@ -1,17 +1,90 @@ 锘縰sing 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() + { + //鍒濆鍖朥I + 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 @@ -27,194 +100,38 @@ }; 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); - } - + } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/AksPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/AksPage.cs index 21a8800..edf4f5d 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/AksPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/AksPage.cs @@ -7,6 +7,9 @@ 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 @@ -45,6 +48,8 @@ /// 鍒犻櫎璁惧鍚庨渶瑕佹洿鏂扮晫闈㈢殑鍥炶皟 /// </summary> public Action action; + + public IntType currnetIntType; public VerticalScrolViewLayout vv; #endregion @@ -89,7 +94,7 @@ this.BackgroundColor = MusicColor.ViewColor; this.topView = new TopView(); this.topView.setBtn.Visible = true; - this.topView.topNameBtn.Text= this.device.name; + this.topView.topNameBtn.Text = this.device.name; this.AddChidren(topView.TopFLayoutView()); } /// <summary> @@ -103,10 +108,8 @@ 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> /// 娉ㄥ唽浜嬩欢 @@ -133,8 +136,8 @@ ////鍒锋柊鏄剧ず 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();//閲嶆柊璁$畻瀹藉害 }); @@ -175,5 +178,150 @@ } }); } + /// <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 ""; + } + } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/BaseFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/BaseFramLayout.cs index fd585bb..1b0e233 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/BaseFramLayout.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/BaseFramLayout.cs @@ -49,4 +49,6 @@ return bottomHeight; } } + + } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ButtonFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ButtonFramLayout.cs index 67f3228..9bf4e83 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ButtonFramLayout.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ButtonFramLayout.cs @@ -146,7 +146,7 @@ EventHandler<MouseEventArgs> UpClick = (sender, e) => { this.BackgroundColor = 0x00000000; - action?.Invoke(this, btnImage, btnName); + //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� }; this.MouseUpEventHandler += UpClick; @@ -156,9 +156,7 @@ //EventHandler<MouseEventArgs> MoveClick = (sender, e) => //{ - // Console.WriteLine("绉诲姩浜嬩欢====="); // this.BackgroundColor = 0x00000000; - // action?.Invoke(this, btnImage, btnName); // //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� //}; //this.MouseMoveEventHandler += MoveClick; @@ -169,6 +167,7 @@ { //鎸変笅鍘绘敼鍙樿儗鏅鑹� this.BackgroundColor = 0xff454635; + action?.Invoke(this, btnImage, btnName); }; this.MouseDownEventHandler += DownClick; btnImage.MouseDownEventHandler += DownClick; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs index cc6989e..80ea0ac 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs @@ -5,7 +5,8 @@ { 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; @@ -16,6 +17,7 @@ this.Height = Application.GetMinRealAverage(height); this.Radius = (uint)Application.GetRealHeight(cornerValue); this.BackgroundColor = MusicColor.ViewColor; + this.Gravity = Gravity.CenterHorizontal; } Button btnTop = new Button { @@ -75,15 +77,147 @@ 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; + } + + + } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/PayerFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/PayerFramLayout.cs index 8d60bca..2b48b6f 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/PayerFramLayout.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/PayerFramLayout.cs @@ -5,36 +5,65 @@ { 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); + } + + + } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeMultiFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeMultiFramLayout.cs index 7a34586..0400c94 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeMultiFramLayout.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeMultiFramLayout.cs @@ -8,97 +8,113 @@ private uint UpBackgroundColor = 0x00000000; private uint DownBackgroundColor = 0xff454635; - public TypeMultiFramLayout() - { - this.BackgroundColor = MusicColor.ViewColor; - this.Height = Application.GetRealHeight(40); - this.Radius = (uint)Application.GetRealHeight(20); - } - - Button btnLeftImage = new Button + /// <summary> + /// 澶氫釜绫诲瀷瀹瑰櫒 + /// </summary> + public FrameLayout multiFramLayout = new FrameLayout { - X = Application.GetRealWidth(16), + BackgroundColor = MusicColor.ViewColor, + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(311), + Height = Application.GetRealHeight(40), + Radius = (uint)Application.GetRealHeight(20), + }; + + + + 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) { @@ -112,63 +128,61 @@ } /// <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>瀛樺湪涓簍rue,鍚﹀垯涓篺alse</returns> - private bool IsAddBtn(View btn) + /// <param name="action">鍥炶皟(绗竴涓槸鐖剁被瀵硅薄</param> + public void SetRightFlClickListener(Action<FrameLayout> action) { - - if (this.ChildrenCount <= 0 || btn == null) + EventHandler<MouseEventArgs> UpClick = (sender, e) => { - return false; - } - for (int i = 0; i < this.ChildrenCount; i++) + rightFramLayout.BackgroundColor = this.UpBackgroundColor; + + //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� + }; + rightFramLayout.MouseUpEventHandler += UpClick; + btnBottonRightImage.MouseUpEventHandler += UpClick; + btnBottonRightName.MouseUpEventHandler += UpClick; + + + EventHandler<MouseEventArgs> DownClick = (sender, e) => { - View view = this.GetChildren(i); - if (view == null) - { - continue; - } - if (view is Button) - { - if (view.Name == btn.Name) - { - return true; - } - } - - } - return false; - + //鎸変笅鍘绘敼鍙樿儗鏅鑹� + rightFramLayout.BackgroundColor = this.DownBackgroundColor; + action?.Invoke(rightFramLayout); + }; + rightFramLayout.MouseDownEventHandler += DownClick; + btnBottonRightImage.MouseDownEventHandler += DownClick; + btnBottonRightName.MouseDownEventHandler += DownClick; } + } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeSingleFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeSingleFramLayout.cs index 73763f8..c357a73 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeSingleFramLayout.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeSingleFramLayout.cs @@ -4,34 +4,39 @@ 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), + X = Application.GetRealWidth(16), Width = Application.GetRealWidth(16), Height = Application.GetRealWidth(16), UnSelectedImagePath = "AksIcon/yingku.png", 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, + TextID = StringId.yingku, TextSize = TextSize.Text16, TextColor = MusicColor.TextColor, TextAlignment = TextAlignment.Center, @@ -40,69 +45,28 @@ 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) { @@ -118,16 +82,16 @@ /// <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; @@ -135,45 +99,13 @@ 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>瀛樺湪涓簍rue,鍚﹀垯涓篺alse</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; - - } - - } } \ No newline at end of file -- Gitblit v1.8.0