public static ArtistBrowseResult ConvertToDto(IArtistBrowse browse) { using(browse) { return Mapper.Map<IArtistBrowse, ArtistBrowseResult>(browse); } }
internal static IntPtr GetPointer(IArtistBrowse artistBrowse) { if (artistBrowse.GetType() == typeof(ArtistBrowseWrapper)) { return(((ArtistBrowseWrapper)artistBrowse).artistBrowse.artistBrowsePtr); } throw new ArgumentException("Invalid artist browse"); }
// ArtistBrowse methods made Synchronously public static void WaitForCompletion(this IArtistBrowse artistBrowse) { var reset = new ManualResetEvent(artistBrowse.IsComplete); ArtistBrowseEventHandler handler = (a, e) => reset.Set(); artistBrowse.Complete += handler; reset.WaitOne(); artistBrowse.Complete -= handler; }
public static IArtistBrowse WaitForCompletion(this IArtistBrowse browse) { var reset = new ManualResetEvent(browse.IsComplete); EventHandler handler = (s, e) => reset.Set(); browse.Completed += handler; reset.WaitOne(); browse.Completed -= handler; return(browse); }
void artistBrowse_Complete(IArtistBrowse sender, ArtistBrowseEventArgs e) { if (sender == artistBrowse) { if (Complete != null) { Complete(this, e); } } }
public static ILink <IImage> ArtistPortraitToLink(this IArtistBrowse artistBrowse, int artistIndex) { return(CreateLink <IImage>( () => { var wrapper = artistBrowse as INativeObject; return wrapper == null ? IntPtr.Zero : wrapper.Handle; }, artistBrowse.Session, h => Spotify.sp_link_create_from_artistbrowse_portrait(h, artistIndex))); }
public ArtistInformation(Artist artist, Dispatcher dispatcher) { _portraits = new NotifyCollection<Image>(); _tracks = new NotifyCollection<Track>(); _albums = new NotifyCollection<Album>(); _similarArtists = new NotifyCollection<Artist>(); _dispatcher = dispatcher; _artist = artist; _browse = _artist.InternalArtist.Browse(); _isLoading = !_browse.IsComplete; _browse.Completed += ArtistBrowseCompleted; }
private void LoadBrowseData(IArtistBrowse browse) { using (browse) { Biography = browse.Biography; foreach (var spotifyAlbum in browse.Albums) { _albums.Add(new Album(_artist, spotifyAlbum, _dispatcher)); } foreach (var spotifyTrack in browse.Tracks) { _tracks.Add(new Track(spotifyTrack, _dispatcher)); } foreach (var spotifyArtist in browse.SimilarArtists) { _similarArtists.Add(new Artist(spotifyArtist, _dispatcher)); } foreach (var spotifyPortrait in browse.Portraits) { using (spotifyPortrait) { _portraits.Add(new Image(_artist.InternalArtist.Session, spotifyPortrait.ImageId)); } } FirstPortrait = _portraits.FirstOrDefault(); } IsLoading = false; RaiseFinishedLoading(); }
internal ArtistBrowseEventArgs(IArtistBrowse result) { this.result = result; }
private IEnumerable<IAlbum> GetAlbumsIncludingTopHits(IArtistBrowse browser) { var topHitTracks = browser.TopHitTracks; var albums = browser.Albums.ToList(); albums.Insert(0, new TopHitsAlbum(browser.Artist, topHitTracks, SpotifySession)); return albums; }
private void LoadBrowseData(IArtistBrowse browse) { using (browse) { Biography = browse.Biography; foreach (var spotifyAlbum in browse.Albums) { _albums.Add(new Album(spotifyAlbum, _dispatcher)); } foreach (var spotifyTrack in browse.Tracks) { _tracks.Add(new Track(spotifyTrack, _dispatcher)); } foreach (var spotifyArtist in browse.SimilarArtists) { _similarArtists.Add(new Artist(spotifyArtist, _dispatcher)); } } IsLoading = false; RaiseFinishedLoading(); }
internal ArtistBrowseEventArgs(IArtistBrowse result, object state) { this.result = result; this.state = state; }