Exemplo n.º 1
0
 private async void Item_Selected(object sender, SelectedItemChangedEventArgs e)
 {
     if (e.SelectedItem is MPDAlbum album)
     {
         await Navigation.PushAsync(SongListPage.CreateWithSearch
                                        (album.Name, MPDCommands.MPD_SEARCH_TYPE.MPD_SEARCH_ALBUM));
     }
 }
        private static void CreateToolbarItems(SongListPage newPage)
        {
            if (newPage.listType == ListType.CURRENT)
            {
                var playItem = new ToolbarItem()
                {
                    Icon = "play_arrow_white.png"
                };
                playItem.Clicked += newPage.PlayItem_Clicked;

                var removeItem = new ToolbarItem()
                {
                    Icon = "remove_white.png"
                };
                removeItem.Clicked += newPage.RemoveItem_Clicked;

                newPage.ToolbarItems.Add(removeItem);
                newPage.ToolbarItems.Add(playItem);
            }
            else if (newPage.listType == ListType.SAVED)
            {
                var loadPlaylistItem = new ToolbarItem()
                {
                    Icon = "library_add_white.png"
                };
                loadPlaylistItem.Clicked += newPage.LoadPlaylist_Clicked;

                newPage.ToolbarItems.Add(loadPlaylistItem);
            }
            else
            {
                var removeItem = new ToolbarItem()
                {
                    Icon = "remove_white.png"
                };
                removeItem.Clicked += newPage.RemoveItem_Clicked;

                var add_Item = new ToolbarItem()
                {
                    Icon = "add_white.png"
                };
                add_Item.Clicked += newPage.AddItem_Clicked;

                newPage.ToolbarItems.Add(removeItem);
                newPage.ToolbarItems.Add(add_Item);
            }
        }
        public static SongListPage CreateWithSearch(string searchValue, MPDCommands.MPD_SEARCH_TYPE searchType)
        {
            SongListPage result = new SongListPage()
            {
                Title = searchValue, type = searchType, listType = ListType.SEARCH
            };

            CreateToolbarItems(result);

            Task t = Task.Factory.StartNew(async() =>
            {
                await Task.Delay(App.PAGE_ANIMATION_DELAY);
                await result.GetSongsFromMPD();
            });

            return(result);
        }
        public static SongListPage CreateWithPlaylist(string playlistName)
        {
            SongListPage result = new SongListPage()
            {
                Title = playlistName, listType = ListType.SAVED
            };

            CreateToolbarItems(result);

            Task t = Task.Factory.StartNew(async() =>
            {
                await Task.Delay(App.PAGE_ANIMATION_DELAY);
                await result.GetSongsFromMPD();
            });

            return(result);
        }
        public static SongListPage CreateWithCurrentPlaylist()
        {
            SongListPage result = new SongListPage()
            {
                Title = "Current Playlist", listType = ListType.CURRENT
            };

            CreateToolbarItems(result);

            Task t = Task.Factory.StartNew(async() =>
            {
                await Task.Delay(App.PAGE_ANIMATION_DELAY);
                await result.GetSongsFromMPD();
            });

            return(result);
        }
Exemplo n.º 6
0
 private async void ArtistListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
 {
     MPDArtist a = e.SelectedItem as MPDArtist;
     await Navigation.PushAsync(SongListPage.CreateWithSearch(a.ArtistName,
                                                              MPDCommands.MPD_SEARCH_TYPE.MPD_SEARCH_ARTIST));
 }
        private void PlaylistView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var playlist = e.SelectedItem as MPDPlaylist;

            Navigation.PushAsync(SongListPage.CreateWithPlaylist(playlist.Name));
        }
 private async void Playlist_Clicked(object sender, EventArgs e)
 {
     await Navigation.PushAsync(SongListPage.CreateWithCurrentPlaylist());
 }