public ArtistOverviewViewModel(IPlatformServices platformServices, IArtistOverviewDataController dataController, IFavouritesService favouritesService, ArtistOverviewViewModelParams p) : base(platformServices) { this.dataController = dataController; this.favouritesService = favouritesService; this.albums = new MainThreadObservableCollectionAdapter <IAlbumViewModel>(this.dataController.Albums, PlatformServices.MainThreadDispatcher); this.topTracks = new MainThreadObservableCollectionAdapter <ITrackViewModel>(this.dataController.TopTracks, PlatformServices.MainThreadDispatcher); this.relatedArtists = new MainThreadObservableCollectionAdapter <IArtistViewModel>(this.dataController.RelatedArtists, PlatformServices.MainThreadDispatcher); this.featuredPlaylists = new MainThreadObservableCollectionAdapter <IPlaylistViewModel>(this.dataController.Playlists, PlatformServices.MainThreadDispatcher); // TODO: Default artwork for artist... // NEEDS to be done before the fetch status changed is added, as event will fire before we've set fallback this.ArtistId = p.ArtistId; this.ArtistImage = "ms-appx:///Assets/StoreLogo.png"; this.dataController.OnAlbumFetchStateChanged += OnAlbumFetchStateChanged; this.dataController.OnTopTrackFetchStateChanged += OnTopTrackFetchStateChanged; this.dataController.OnPlaylistFetchStateChanged += OnPlaylistFetchStateChanged; this.dataController.OnRelatedArtistFetchStateChanged += OnRelatedArtistFetchStateChanged; this.dataController.OnCompleteArtistFetchStateChanged += OnCompleteArtistFetchStateChanged; this.dataController.FetchOverviewAsync(this.ArtistId); UpdateFavouriteState(); this.favouritesService.OnFavouritesChanged += OnFavouritesChanged; }
public IArtistOverviewViewModel CreateArtistOverviewViewModel(ArtistOverviewViewModelParams p) => new ArtistOverviewViewModel(ServiceRegistry.PlatformServices, ServiceRegistry.GetService <IArtistOverviewDataController>(), ServiceRegistry.FavouritesService, p);