From 99251846b303790a1f68f6bbaff16d642892195d Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期五, 29 五月 2020 16:59:20 +0800 Subject: [PATCH] 2020-05-29-1 --- HDL_ON/UI/Music/View/DialogView.cs | 354 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 353 insertions(+), 1 deletions(-) diff --git a/HDL_ON/UI/Music/View/DialogView.cs b/HDL_ON/UI/Music/View/DialogView.cs index b72fab6..55f9d6e 100644 --- a/HDL_ON/UI/Music/View/DialogView.cs +++ b/HDL_ON/UI/Music/View/DialogView.cs @@ -5,7 +5,10 @@ { public class DialogView { - + /// <summary> + ///寮圭獥鏂囦欢澶瑰垪琛ㄧ晫闈� + /// </summary> + /// <param name="musicInfo"></param> public void FieListView(MusicInfo musicInfo) { //涓绘帶浠� @@ -219,5 +222,354 @@ } + /// <summary> + /// 閫変腑缁勫悎鐨勬挱鏀惧櫒鐨勭晫闈� + /// </summary> + public void PlayMergence() + { + //涓绘帶浠� + Dialog dialog = new Dialog() + { + BackgroundColor = Color.PopupBackgroundColor, + }; + dialog.Show(); + //鐖舵帶浠� + FrameLayout frame = new FrameLayout { }; + dialog.AddChidren(frame); + frame.MouseUpEventHandler += (sen, e) => + { + dialog.Close(); + }; + //鐧借壊蹇埗鎺т欢 + FrameLayout dialogFra = new FrameLayout() + { + X = Application.GetRealWidth(16), + Y = Application.GetRealHeight(397), + Width = Application.GetRealWidth(344), + Height = Application.GetRealHeight(250), + BackgroundColor = Color.WhiteColor, + Radius = (uint)Application.GetRealHeight(12), + }; + frame.AddChidren(dialogFra); + //鏄剧ず澶撮儴淇℃伅鐖舵帶浠� + FrameLayout topFra = new FrameLayout() + { + Width = Application.GetRealWidth(344), + Height = Application.GetRealHeight(50), + }; + dialogFra.AddChidren(topFra); + //鍙栨秷鎺т欢 + Button cancelnBtn = new Button + { + X = Application.GetRealWidth(20), + Y = Application.GetRealHeight(15), + Width = Application.GetRealWidth(60), + Height = Application.GetRealHeight(20), + TextID = StringId.cancelMusic, + TextAlignment = TextAlignment.CenterLeft, + TextColor = Color.MusicNoTxetColor, + TextSize = TextSize.Text14, + }; + topFra.AddChidren(cancelnBtn); + cancelnBtn.MouseUpEventHandler += (sen, e) => + { + dialog.Close(); + }; + //鏍囬鎺т欢 + Button txetBtn = new Button + { + X = cancelnBtn.Right + Application.GetRealWidth(20), + Y = Application.GetRealHeight(14), + Width = Application.GetRealWidth(152), + Height = Application.GetRealHeight(22), + TextColor = Color.TextColor, + TextSize = TextSize.Text16, + TextAlignment = TextAlignment.Center, + TextID = StringId.selectedMergence, + IsBold = true, + }; + topFra.AddChidren(txetBtn); + + //纭鎺т欢 + Button confirmBtn = new Button + { + X = Application.GetRealWidth(344 - 60 - 20), + Y = Application.GetRealHeight(15), + Width = Application.GetRealWidth(60), + Height = Application.GetRealHeight(20), + TextID = StringId.confirmMusic, + TextAlignment = TextAlignment.CenterRight, + TextColor = Color.SelectedColor, + TextSize = TextSize.Text14, + }; + topFra.AddChidren(confirmBtn); + + VerticalScrolViewLayout verticalScrolViewLayout = new VerticalScrolViewLayout + { + Y = Application.GetRealHeight(50), + Height = dialogFra.Height - Application.GetRealHeight(50), + Width = Application.GetRealWidth(344), + }; + dialogFra.AddChidren(verticalScrolViewLayout); + var playList = new List<A31MusicModel>(); + for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++) + { + var player = A31MusicModel.A31MusicModelList[i]; + if (!player.IsOnLine) + { + //涓嶅湪绾夸笉鏄剧ず; + continue; + } + RowLayout PlayRow = new RowLayout + { + Height = Application.GetRealHeight(50), + LineColor = Color.WhiteColor, + SubViewWidth = Application.GetRealWidth(80),//鏀瑰彉缂栬緫鎺т欢瀹藉害澶氬皯锛� + }; + verticalScrolViewLayout.AddChidren(PlayRow); + + + //鎾斁鍣ㄥ悕绉版帶浠� + Button PlayNameBtn = new Button + { + X = Application.GetRealWidth(20), + Y = Application.GetRealHeight(15), + Width = Application.GetRealWidth(150), + Height = Application.GetRealHeight(20), + TextColor = Color.TextColor, + TextSize = TextSize.Text14, + TextAlignment = TextAlignment.CenterLeft, + Text = player.Name, + }; + PlayRow.AddChidren(PlayNameBtn); + + + //閫変腑鍥炬爣鎺т欢 + Button selectedIconBtn = new Button + { + X = Application.GetRealWidth(303), + Y = Application.GetRealHeight(11), + Width = Application.GetMinRealAverage(28), + Height = Application.GetMinRealAverage(28), + UnSelectedImagePath = "MusicIcon/noSelectedIcon.png", + SelectedImagePath = "MusicIcon/selectedIcon.png", + }; + PlayRow.AddChidren(selectedIconBtn); + + ///鍔犲ぇ鍑犵偣鑼冨洿 + Button clickBtn = new Button + { + Height = Application.GetRealHeight(50), + }; + PlayRow.AddChidren(clickBtn); + + clickBtn.MouseUpEventHandler += (sender, e) => + { + clickBtn.IsSelected = !clickBtn.IsSelected; + selectedIconBtn.IsSelected = clickBtn.IsSelected; + var musicPlayer = playList.Find((c) => c.UniqueDeviceName == player.UniqueDeviceName); + if (selectedIconBtn.IsSelected) + { + if (musicPlayer == null) + { + playList.Add(player); + } + } + else + { + if (musicPlayer != null) + { + playList.Remove(player); + } + } + }; + //绾� + Button lineBtn = new Button + { + Y = PlayRow.Height - 1, + X = Application.GetRealWidth(20), + Width = Application.GetRealWidth(304), + Height = 1, + BackgroundColor = Color.LineColor, + }; + PlayRow.AddChidren(lineBtn); + } + confirmBtn.MouseUpEventHandler += (sender, e) => + { + if (playList.Count <= 1) + { + new PublicAssmebly().TipMsgAutoClose("鑷冲皯閫変腑涓や釜浠ヤ笂鎾斁鍣�", false); + return; + } + PlayerView(dialog, playList); + }; + } + /// <summary> + /// 閫変腑涓绘挱鏀惧櫒鐨勭晫闈� + /// </summary> + /// <param name="musicList"></param> + void PlayerView(Dialog dialogF ,List<A31MusicModel> musicList) + { + //涓绘帶浠� + Dialog dialog = new Dialog() + { + //BackgroundColor = Color.PopupBackgroundColor, + }; + dialog.Show(); + //鐖舵帶浠� + FrameLayout frame = new FrameLayout { }; + dialog.AddChidren(frame); + frame.MouseUpEventHandler += (sen, e) => + { + dialog.Close(); + }; + //鐧借壊蹇埗鎺т欢 + FrameLayout dialogFra = new FrameLayout() + { + X = Application.GetRealWidth(16), + Y = Application.GetRealHeight(397), + Width = Application.GetRealWidth(344), + Height = Application.GetRealHeight(250), + BackgroundColor = Color.WhiteColor, + Radius = (uint)Application.GetRealHeight(12), + }; + frame.AddChidren(dialogFra); + //鏄剧ず澶撮儴淇℃伅鐖舵帶浠� + FrameLayout topFra = new FrameLayout() + { + Width = Application.GetRealWidth(344), + Height = Application.GetRealHeight(50), + }; + dialogFra.AddChidren(topFra); + //鍙栨秷鎺т欢 + Button cancelnBtn = new Button + { + X = Application.GetRealWidth(20), + Y = Application.GetRealHeight(15), + Width = Application.GetRealWidth(60), + Height = Application.GetRealHeight(20), + TextID = StringId.cancelMusic, + TextAlignment = TextAlignment.CenterLeft, + TextColor = Color.MusicNoTxetColor, + TextSize = TextSize.Text14, + }; + topFra.AddChidren(cancelnBtn); + cancelnBtn.MouseUpEventHandler += (sen, e) => + { + dialog.Close(); + }; + //鏍囬鎺т欢 + Button txetBtn = new Button + { + X = cancelnBtn.Right + Application.GetRealWidth(20), + Y = Application.GetRealHeight(14), + Width = Application.GetRealWidth(152), + Height = Application.GetRealHeight(22), + TextColor = Color.TextColor, + TextSize = TextSize.Text16, + TextAlignment = TextAlignment.Center, + TextID = StringId.readyPlay, + IsBold = true, + }; + topFra.AddChidren(txetBtn); + + //纭鎺т欢 + Button confirmBtn = new Button + { + X = Application.GetRealWidth(344 - 60 - 20), + Y = Application.GetRealHeight(15), + Width = Application.GetRealWidth(60), + Height = Application.GetRealHeight(20), + TextID = StringId.confirmMusic, + TextAlignment = TextAlignment.CenterRight, + TextColor = Color.SelectedColor, + TextSize = TextSize.Text14, + }; + topFra.AddChidren(confirmBtn); + confirmBtn.MouseUpEventHandler += (sender, e) => + { + + }; + VerticalScrolViewLayout verticalScrolViewLayout = new VerticalScrolViewLayout + { + Y = Application.GetRealHeight(50), + Height = dialogFra.Height - Application.GetRealHeight(50), + Width = Application.GetRealWidth(344), + }; + dialogFra.AddChidren(verticalScrolViewLayout); + //璁板綍閫変腑鐘舵�� + Button selectedBtn = new Button() { Tag="No"}; + for (int i = 0; i < musicList.Count; i++) + { + var player = musicList[i]; + RowLayout addFlieRow = new RowLayout + { + Height = Application.GetRealHeight(50), + LineColor = Color.WhiteColor, + }; + verticalScrolViewLayout.AddChidren(addFlieRow); + + //鎾斁鍣ㄥ悕绉版帶浠� + Button PlayNameBtn = new Button + { + X = Application.GetRealWidth(20), + Y = Application.GetRealHeight(15), + Width = Application.GetRealWidth(150), + Height = Application.GetRealHeight(20), + TextColor = Color.TextColor, + TextSize = TextSize.Text14, + TextAlignment = TextAlignment.CenterLeft, + Text = player.Name, + }; + addFlieRow.AddChidren(PlayNameBtn); + + //閫変腑鍥炬爣鎺т欢 + Button selectedIconBtn = new Button + { + X = Application.GetRealWidth(303), + Y = Application.GetRealHeight(11), + Width = Application.GetMinRealAverage(28), + Height = Application.GetMinRealAverage(28), + UnSelectedImagePath = "MusicIcon/noSelectedIcon.png", + SelectedImagePath = "MusicIcon/selectedIcon.png", + }; + addFlieRow.AddChidren(selectedIconBtn); + ///鍔犲ぇ鍑犵偣鑼冨洿 + Button clickBtn = new Button + { + Height = Application.GetRealHeight(50), + }; + addFlieRow.AddChidren(clickBtn); + clickBtn.MouseUpEventHandler += (sender, e) => + { + selectedBtn.IsSelected = false; + selectedBtn.Tag = "Yes"; + selectedBtn = selectedIconBtn; + selectedBtn.IsSelected = true; + }; + //绾� + Button lineBtn = new Button + { + Y = addFlieRow.Height - 1, + X = Application.GetRealWidth(20), + Width = Application.GetRealWidth(304), + Height = 1, + BackgroundColor = Color.LineColor, + }; + addFlieRow.AddChidren(lineBtn); + } + + confirmBtn.MouseUpEventHandler += (sender, e) => + { + if (selectedBtn.Tag.ToString() == "No") + { + new PublicAssmebly().TipMsgAutoClose("杩樻病閫変腑鎾斁鍣�", false); + return; + } + dialogF.Close(); + dialog.Close(); + }; + + } } } -- Gitblit v1.8.0