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 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)); }