public ArtistSinglesViewModel(Artist artist)
 {
     PlayAudioTrack = delegate(Track track)
     {
         var l =
             MediaPropertiesLibrary.Audio.Library.Library.Songs.Where(t => t.Artists.Contains(artist))
                 .ToList();
         DispatcherLibrary.Dispatcher.Dispatch("Multiple Track Selected For Play", l, l.FindIndex(t => t == track));
     };
     _singles.Source = new ObservableCollection<Track>(artist.Singles);
     Singles.Refresh();
     OnPropertyChanged(nameof(Singles));
 }
Ejemplo n.º 2
0
 public ArtistAlbumsViewModel(Artist artist)
 {
     PlayAlbum = new PlayAlbum(album =>
     {
         var l =
             MediaPropertiesLibrary.Audio.Library.Library.Songs.Where(track => track.Artists.Contains(artist))
                 .ToList();
         DispatcherLibrary.Dispatcher.Dispatch("Multiple Track Selected For Play", l, l.FindIndex(track => track.Album == album));
     });
     _albums.Source = new ObservableCollection<Album>(artist.Albums);
     Albums.Refresh();
     OnPropertyChanged(nameof(Albums));
 }
Ejemplo n.º 3
0
        public ArtistViewModel(Artist artist)
        {
            var genres =
                Library.Songs.Where(track => track.Artists.Contains(artist)).SelectMany(track => track.Genres).Distinct().ToList();

            var t =
                Library.Songs.Where(track => track.Genres.Intersect(genres).Any())
                    .SelectMany(track => track.Artists).Where(artist2 => artist2 != artist).Distinct()
                    .OrderBy(a => Library.Songs.Where(track => track.Artists.Contains(a)).SelectMany(track => track.Genres).Intersect(genres).Count())
                    .ToList();

            Artist = artist;
            PopularModel = new ArtistViewPopularModel
            {
                MostListenedTracks = Library.Songs.Where(track => track.Artists.Contains(artist)).OrderByDescending(track => track.UserTag.TimesListened).Take(5).ToList(),
                RelatedArtists = t.Take(7).ToList()
            };
            AlbumsModel = new ArtistAlbumsViewModel(artist);
            SinglesModel = new ArtistSinglesViewModel(artist);
        }
Ejemplo n.º 4
0
 public static ImageSource AccessCover(Artist artist)
 {
     if (!string.IsNullOrEmpty(artist.Tag?.Picture) && File.Exists(artist.Tag.Picture))
         return new BitmapImage(new Uri(artist.Tag.Picture));
     return artist.Albums.FirstOrDefault(album => album.Cover != null)?.Cover;
 }
Ejemplo n.º 5
0
 public void AccessArtist(Artist artist)
 {
     if (artist != null)
         Dispatcher.Dispatch("Publish pages", new Pages.ArtistView(new Pages.ArtistViewModel(artist)));
 }