Beispiel #1
0
        private async void Refresh()
        {
            await ServiceLocator.LocalMusicService.Clear();

            if (Tracks != null)
            {
                Tracks.Clear();
            }

            if (Artists != null)
            {
                Artists.Clear();
            }

            if (Albums != null)
            {
                Albums.Clear();
            }

            if (AlbumGroups != null)
            {
                AlbumGroups.Clear();
            }

            if (SelectedArtistAlbums != null)
            {
                SelectedArtistAlbums.Clear();
            }

            var flyout = new FlyoutControl();

            flyout.FlyoutContent = new MusicScanView();
            await flyout.ShowAsync();

            switch (SelectedTabIndex)
            {
            case 0:
                LoadTracks();
                break;

            case 1:
                LoadAlbums();
                break;

            case 2:
                LoadArtists();
                break;
            }
        }
Beispiel #2
0
        private void InitializeCommands()
        {
            PlayAudioCommand = new RelayCommand <Audio>(audio =>
            {
                AudioService.Play(audio);

                if (SelectedTabIndex == 0)
                {
                    var searchControl = LocalSearchControl.GetForCurrentView();
                    if (searchControl != null && searchControl.IsFiltering)
                    {
                        AudioService.SetCurrentPlaylist((searchControl.Source.View).Cast <Audio>());
                    }
                    else
                    {
                        AudioService.SetCurrentPlaylist(Tracks);
                    }
                }
                else if (SelectedArtistAlbums != null)
                {
                    AudioService.SetCurrentPlaylist(SelectedArtistAlbums.Where(a => !a.Tracks.IsNullOrEmpty()).SelectMany(a => a.Tracks).ToList());
                }
            });

            GoToAlbumCommand = new RelayCommand <AudioAlbum>(album =>
            {
                MessengerInstance.Send(new NavigateToPageMessage()
                {
                    Page       = "/Local.LocalAlbumView",
                    Parameters = new Dictionary <string, object>()
                    {
                        { "album", album }
                    }
                });
            });

            RefreshCommand = new RelayCommand(() =>
            {
                Refresh();
            });
        }