private void OnAddToPlaylistClick(object sender, RoutedEventArgs e) { PlaylistPicker.Pick( ViewModel.ArtistAlbums .SelectMany(x => x.MediaFiles) .Select(x => PlaylistItem.FromMediaFile(x))); }
private void OnAddToPlaylistClicked(object sender, RoutedEventArgs e) { IEnumerable <PlaylistItem> items; var ctx = (CommonViewItemModel)DataContext; if (ctx.Type == CommonItemType.Album) { using (var scope = ApplicationServiceBase.App.GetScope()) using (var context = scope.ServiceProvider.GetRequiredService <MedialibraryDbContext>()) { items = context.Albums .Include(c => c.MediaFiles) .First(i => i.Id == ctx.InternalDbEntityId) .MediaFiles.Select(x => PlaylistItem.FromMediaFile(x)).ToArray(); } } else if (ctx.Type == CommonItemType.Artist) { using (var scope = ApplicationServiceBase.App.GetScope()) using (var context = scope.ServiceProvider.GetRequiredService <MedialibraryDbContext>()) { items = context.Artists .Include(c => c.MediaFiles) .First(i => i.Id == ctx.InternalDbEntityId) .MediaFiles.Select(x => PlaylistItem.FromMediaFile(x)).ToArray(); } } else { throw new NotSupportedException(); } PlaylistPicker.Pick(items); }
private void AddToPlaylist(object obj) { if (PlaybackControl.Instance.Current?.File != null) { PlaylistPicker.Pick(PlaylistItem.FromMediaFile( PlaybackControl.Instance.Current.File)); } }
private void OnAddToPlaylistClick(object sender, RoutedEventArgs e) { if (PlaybackControl.Instance.Current?.File != null) { PlaylistPicker.Pick(PlaylistItem.FromMediaFile( PlaybackControl.Instance.Current.File)); } }
private void AddToMenuFlyoutItem_OnClick(object sender, RoutedEventArgs e) { UiBlockerUtility.BlockNavigation(); var picker = new PlaylistPicker(_song) { Action = async playlist => { App.SupressBackEvent -= AppOnSupressBackEvent; UiBlockerUtility.Unblock(); ModalSheetUtility.Hide(); await App.Locator.CollectionService.AddToPlaylistAsync(playlist, _song).ConfigureAwait(false); } }; App.SupressBackEvent += AppOnSupressBackEvent; ModalSheetUtility.Show(picker); }
public static void AddToPlaylistDialog(List<Song> songs) { UiBlockerUtility.BlockNavigation(); var picker = new PlaylistPicker(songs) { Action = async playlist => { App.SupressBackEvent -= AppOnSupressBackEvent; UiBlockerUtility.Unblock(); ModalSheetUtility.Hide(); for (var i = 0; i < songs.Count; i++) { var song = songs[i]; // only add if is not there already if (playlist.Songs.FirstOrDefault(p => p.SongId == song.Id) == null) { await App.Locator.CollectionService.AddToPlaylistAsync(playlist, song).ConfigureAwait(false); } if (App.Locator.Player.CurrentQueue != null || !App.Locator.Settings.AddToInsert) { continue; } songs.RemoveAt(0); songs.Reverse(); songs.Insert(0, song); } } }; App.SupressBackEvent += AppOnSupressBackEvent; ModalSheetUtility.Show(picker); }
private void OnAddToPlaylistClick(object sender, RoutedEventArgs e) { PlaylistPicker.Pick(ViewModel.ViewItems.Select(x => PlaylistItem.FromMediaFile(x))); }
private void OnAddToPlaylistClicked(object sender, RoutedEventArgs e) { PlaylistPicker.Pick(PlaylistItem.FromMediaFile(File.File)); }