Esempio n. 1
0
 public static ArtistBrowseResult ConvertToDto(IArtistBrowse browse)
 {
     using(browse)
     {
         return Mapper.Map<IArtistBrowse, ArtistBrowseResult>(browse);
     }
 }
Esempio n. 2
0
 internal static IntPtr GetPointer(IArtistBrowse artistBrowse)
 {
     if (artistBrowse.GetType() == typeof(ArtistBrowseWrapper))
     {
         return(((ArtistBrowseWrapper)artistBrowse).artistBrowse.artistBrowsePtr);
     }
     throw new ArgumentException("Invalid artist browse");
 }
Esempio n. 3
0
        // 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;
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 void artistBrowse_Complete(IArtistBrowse sender, ArtistBrowseEventArgs e)
 {
     if (sender == artistBrowse)
     {
         if (Complete != null)
         {
             Complete(this, e);
         }
     }
 }
Esempio n. 6
0
 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();
        }
Esempio n. 9
0
 internal ArtistBrowseEventArgs(IArtistBrowse result)
 {
     this.result = result;
 }
Esempio n. 10
0
 internal ArtistBrowseEventArgs(IArtistBrowse result)
 {
     this.result = result;
 }
Esempio n. 11
0
 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;
 }
Esempio n. 12
0
        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();
        }
Esempio n. 13
0
 internal ArtistBrowseEventArgs(IArtistBrowse result, object state)
 {
     this.result = result;
     this.state = state;
 }