public override async void Execute(object parameter)
        {
            var items = (ObservableCollection <IStorageItem>)parameter;
            var files = new List <StorageFile>();

            foreach (var item in items)
            {
                var file = item as StorageFile;
                if (file != null && VLCFileExtensions.Supported.Contains(file.FileType.ToLower()))
                {
                    files.Add((StorageFile)item);
                }
            }
            var playlist = new ObservableCollection <IVLCMedia>();

            foreach (var file in files)
            {
                if (VLCFileExtensions.AudioExtensions.Contains(file.FileType.ToLower()))
                {
                    var trackItem = await MusicLibraryManagement.GetTrackItemFromFile(file);

                    playlist.Add(trackItem);
                }
                else if (VLCFileExtensions.VideoExtensions.Contains(file.FileType.ToLower()))
                {
                    var videoVm = new VideoItem();
                    await videoVm.Initialize(file);

                    playlist.Add(videoVm);
                }
            }
            await PlaylistHelper.AddTrackCollectionToPlaylistAndPlay(playlist, true, 0);
        }
        public override async void Execute(object parameter)
        {
            var trackCollection = Locator.MusicLibraryVM.CurrentTrackCollection;

            if (trackCollection == null || trackCollection.Playlist == null || !trackCollection.Playlist.Any())
            {
                return;
            }
            if (parameter is int)
            {
                await PlaylistHelper.AddTrackCollectionToPlaylistAndPlay(trackCollection.Playlist, true, (int)parameter);
            }
            else if (parameter is ItemClickEventArgs)
            {
                var track = (TrackItem)((ItemClickEventArgs)parameter).ClickedItem;
                var index = trackCollection.Playlist.IndexOf(track);
                await PlaylistHelper.AddTrackCollectionToPlaylistAndPlay(trackCollection.Playlist, true, index);
            }
            else
            {
                await PlaylistHelper.AddTrackCollectionToPlaylistAndPlay(trackCollection.Playlist);
            }
            Locator.NavigationService.GoBack_HideFlyout();
            Locator.NavigationService.Go(VLCPage.MusicPlayerPage);
        }
        public override async void Execute(object parameter)
        {
            if (Locator.MusicLibraryVM.Tracks == null || !Locator.MusicLibraryVM.Tracks.Any())
            {
                return;
            }
            var shuffledTracks = Locator.MusicLibraryVM.Tracks.Shuffle();
            await PlaylistHelper.AddTrackCollectionToPlaylistAndPlay(shuffledTracks.ToPlaylist());

            Locator.NavigationService.Go(VLCPage.MusicPlayerPage);
        }
Example #4
0
        public override async void Execute(object parameter)
        {
            Locator.NavigationService.Go(VLCPage.MusicPlayerPage);
            Locator.MusicLibraryVM.IsAlbumPageShown = false;
            if (parameter is ArtistItem)
            {
                var artist = parameter as ArtistItem;
                var tracks = await Locator.MusicLibraryVM._trackDatabase.LoadTracksByArtistId(artist.Id).ToObservableAsync();

                await PlaylistHelper.AddTrackCollectionToPlaylistAndPlay(tracks.ToPlaylist());
            }
        }
Example #5
0
        public override async void Execute(object parameter)
        {
            if (Locator.MusicLibraryVM.Tracks == null || !Locator.MusicLibraryVM.Tracks.Any())
            {
                return;
            }
            var itemClickArgs = parameter as ItemClickEventArgs;
            var index         = 0;

            if (itemClickArgs != null)
            {
                var selectedTrack = itemClickArgs.ClickedItem as TrackItem;
                index = Locator.MusicLibraryVM.Tracks.IndexOf(selectedTrack);
            }
            await PlaylistHelper.AddTrackCollectionToPlaylistAndPlay(Locator.MusicLibraryVM.Tracks.ToPlaylist(), true, index);

            Locator.NavigationService.Go(VLCPage.MusicPlayerPage);
        }