using System; using System.Collections.Generic; using Shared; using Shared.SimpleControl; using Shared.SimpleControl.Phone.Music; namespace SmartHome.UI.SimpleControl.Phone.Music { class A31TidalRisingPage : FrameLayout { public override void RemoveFromParent () { base.RemoveFromParent (); isExit = true; } public void Show (string path,string listname) { AddChidren (new Button { Height = Application.GetRealHeight (36), BackgroundColor = SkinStyle.Current.MusicTopFrameLayout, }); var topFrameLayout = new FrameLayout { Height = Application.GetRealHeight (100), Y = Application.GetRealHeight (36), BackgroundColor = SkinStyle.Current.MusicTopFrameLayout, }; AddChidren (topFrameLayout); var whatnew = new Button { //TextID = MyInternationalizationString.Musiclike, Text =listname.ToUpper(), TextColor = SkinStyle.Current.MusicTextColor, }; topFrameLayout.AddChidren (whatnew); var Search = new Button { Width = Application.GetMinRealAverage (60), Height = Application.GetMinRealAverage (80), X = Application.GetRealWidth (535), Gravity = Gravity.CenterVertical, UnSelectedImagePath = "MusicIcon/seekdevice.png", }; //topFrameLayout.AddChidren (Search); Search.MouseUpEventHandler += (sender, e) => { }; var back = new Button { Width = Application.GetRealWidth (82), Height = Application.GetRealHeight (89), X = Application.GetRealWidth (10), Gravity = Gravity.CenterVertical, UnSelectedImagePath = "MusicIcon/HomepageBack.png", }; topFrameLayout.AddChidren (back); back.MouseDownEventHandler += (sender, e) => { RemoveFromParent (); }; VerticalScrolViewLayout middle = new VerticalScrolViewLayout { Y = topFrameLayout.Bottom, Height = Application.GetRealHeight (Application.DesignHeight - 136), BackgroundColor = SkinStyle.Current.MusicVerticalScrolViewLayout, }; AddChidren (middle); var directoryList = Tidal.TempMusicInfoList.FindAll ((obj) => obj.Tag.ToString () == path && obj.IsDirectory); foreach (var musicInfo in directoryList) { var row = new RowLayout { Height = Application.GetRealHeight (100), LineColor = SkinStyle.Current.MusicRowLayoutLineColor, }; middle.AddChidren (row); var imageBtn = new Button { Width = Application.GetRealWidth (80), Height = Application.GetRealHeight (70), X = Application.GetRealWidth (30), Gravity = Gravity.CenterVertical, Radius = (uint)Application.GetRealHeight (4), UnSelectedImagePath = System.IO.File.Exists (musicInfo.Image) ? musicInfo.Image : "MusicIcon/musicplay1.png", }; row.AddChidren (imageBtn); var btnPlaylist = new Button { Height = Application.GetRealHeight (100), Width = Application.GetRealWidth (400), Text = musicInfo.Title, TextAlignment = TextAlignment.CenterLeft, X = Application.GetRealWidth (130), Tag = musicInfo.URL, TextColor = SkinStyle.Current.MusicTextColor, }; row.AddChidren (btnPlaylist); var nextPlaylist = new Button { Width = Application.GetRealWidth (87), Height = Application.GetRealHeight (100), UnSelectedImagePath = "MusicIcon/Next.png", TextAlignment = TextAlignment.CenterLeft, X = Application.GetRealWidth (550), Gravity = Gravity.CenterVertical, }; row.AddChidren (nextPlaylist); EventHandler PlayMuisclistsource = (sender, e) => { Tidal.ReadPlayList (musicInfo.ID, () => { Application.RunOnMainThread (() => { MainPage.Loading.Hide (); RemoveFromParent (); var a31TidalLogin = new A31TidalLogin (); MainPage.MainFrameLayout.AddChidren (a31TidalLogin); a31TidalLogin.Show (A31MusicModel.Current); }); }, (p) => { Application.RunOnMainThread (() => { MainPage.Loading.Hide (); var a31TidalRisingPage = new A31TidalRisingPage (); MainPage.MainFrameLayout.AddChidren (a31TidalRisingPage); a31TidalRisingPage.Show (p,btnPlaylist.Text); }); }); }; nextPlaylist.MouseUpEventHandler += PlayMuisclistsource; btnPlaylist.MouseUpEventHandler += PlayMuisclistsource; imageBtn.MouseUpEventHandler += PlayMuisclistsource; } var listMusic = Tidal.TempMusicInfoList.FindAll ((obj) => obj.Tag.ToString () == path && !obj.IsDirectory); for (int i = 0; i < listMusic.Count; i++) { var musicInfo = listMusic [i]; var row = new RowLayout { Height = Application.GetRealHeight (100), LineColor = SkinStyle.Current.MusicRowLayoutLineColor, }; middle.AddChidren (row); var imageBtn = new Button { Width = Application.GetRealWidth (61), Height = Application.GetRealHeight (61), X = Application.GetRealWidth (20), Gravity = Gravity.CenterVertical, Radius = (uint)Application.GetRealHeight (4), UnSelectedImagePath = System.IO.File.Exists (musicInfo.Image) ? musicInfo.Image : "MusicIcon/musicplay1.png", Tag = musicInfo, }; row.AddChidren (imageBtn); var listmusic = new Button { Width = Application.GetRealWidth (400), Height = Application.GetRealHeight (50), Text = musicInfo.Title, TextAlignment = TextAlignment.BottomLeft, X = Application.GetRealWidth (100), Tag = musicInfo, TextColor = SkinStyle.Current.MusicTextColor, }; row.AddChidren (listmusic); var artists = new Button { Width = Application.GetRealWidth (400), Height = Application.GetRealHeight (50), TextAlignment = TextAlignment.TopLeft, X = Application.GetRealWidth (100), Y = listmusic.Bottom, //TextColor = 0x75ffffff, Text = musicInfo.Artist, Tag = musicInfo, TextColor = SkinStyle.Current.MusicArtistTextColor, }; row.AddChidren (artists); EventHandler TrackMusic = (sender, e) => { row.BackgroundColor = 0xffFE5E00; System.Threading.Tasks.Task.Run (() => { Application.RunOnMainThread (() => { for (int a = MainPage.MainFrameLayout.ChildrenCount - 1; 0 <= a; a--) { var viwe = MainPage.MainFrameLayout.GetChildren (a); if (viwe.GetType () == typeof (A31TidalRisingPage)) { viwe.RemoveFromParent (); } else { break; } } MainPage.MainFrameLayout.RemoveAt (MainPage.MainFrameLayout.ChildrenCount - 1); MainPage.MainFrameLayout.RemoveAt (MainPage.MainFrameLayout.ChildrenCount - 1); MainPage.MainFrameLayout.RemoveAt (MainPage.MainFrameLayout.ChildrenCount - 1); A31PlayMusicPage a31PlayMusicPage = new A31PlayMusicPage (); MainPage.MainFrameLayout.AddChidren (a31PlayMusicPage); a31PlayMusicPage.Show (new List ()); A31MusicModel.Current.A31PlayStatus.Title = listmusic.Text; System.Threading.Tasks.Task.Run (() => { A31NewPage.tidalpushList (listmusic.Tag as MusicInfo, listMusic); }); }); }); }; imageBtn.MouseUpEventHandler += TrackMusic; listmusic.MouseUpEventHandler += TrackMusic; artists.MouseUpEventHandler += TrackMusic; } System.Threading.Tasks.Task.Run (() => { for (int i = 0; i < listMusic.Count; i++) { if (isExit) { return; } Tidal.ReadRealUrl (listMusic [i]); } }); } bool isExit; } }