Exemplo n.º 1
0
 private void ArtistBrowse__Complete(IntPtr artistBrowsePtr, IntPtr userdataPtr)
 {
     if (artistBrowsePtr == this.artistBrowsePtr)
     {
         this.isComplete = true;
         session.EnqueueEventWorkItem(new EventWorkItem(CreateDelegate <ArtistBrowseEventArgs>(ab => ab.OnComplete, this), new ArtistBrowseEventArgs(this)));
         _Complete -= new artistbrowse_complete_cb(ArtistBrowse__Complete);
     }
 }
Exemplo n.º 2
0
        protected override void OnDispose()
        {
            _Complete          -= new artistbrowse_complete_cb(ArtistBrowse__Complete);
            session.DisposeAll -= new SessionEventHandler(session_DisposeAll);

            if (!session.ProcExit)
            {
                lock (libspotify.Mutex)
                    libspotify.sp_artistbrowse_release(artistBrowsePtr);
            }

            artistBrowsePtr = IntPtr.Zero;
        }
Exemplo n.º 3
0
 public static extern IntPtr sp_artistbrowse_create(IntPtr sessionPtr, IntPtr artistPtr, sp_artistbrowse_type type, artistbrowse_complete_cb callback, IntPtr userDataPtr);
Exemplo n.º 4
0
        private ArtistBrowse(Session session, IntPtr artistBrowsePtr)
        {
            if (artistBrowsePtr == IntPtr.Zero)
            {
                throw new ArgumentException("artistBrowsePtr can't be zero.");
            }

            if (session == null)
            {
                throw new ArgumentNullException("Session can't be null.");
            }
            this.session = session;

            this.artistBrowsePtr = artistBrowsePtr;

            this.portraitIds = new DelegateArray <string>(() =>
            {
                IsAlive(true);
                lock (libspotify.Mutex)
                    return(libspotify.sp_artistbrowse_num_portraits(artistBrowsePtr));
            }, (index) =>
            {
                IsAlive(true);
                lock (libspotify.Mutex)
                    return(libspotify.ImageIdToString(libspotify.sp_artistbrowse_portrait(artistBrowsePtr, index)));
            });

            this.tracks = new DelegateArray <ITrack>(() =>
            {
                IsAlive(true);
                lock (libspotify.Mutex)
                    return(libspotify.sp_artistbrowse_num_tracks(artistBrowsePtr));
            }, (index) =>
            {
                IsAlive(true);
                lock (libspotify.Mutex)
                    return(Track.Get(session, libspotify.sp_artistbrowse_track(artistBrowsePtr, index)));
            });

            this.albums = new DelegateArray <IAlbum>(() =>
            {
                IsAlive(true);
                lock (libspotify.Mutex)
                    return(libspotify.sp_artistbrowse_num_albums(artistBrowsePtr));
            }, (index) =>
            {
                IsAlive(true);
                lock (libspotify.Mutex)
                    return(Album.Get(session, libspotify.sp_artistbrowse_album(artistBrowsePtr, index)));
            });

            this.similarArtists = new DelegateArray <IArtist>(() =>
            {
                IsAlive(true);
                lock (libspotify.Mutex)
                    return(libspotify.sp_artistbrowse_num_similar_artists(artistBrowsePtr));
            }, (index) =>
            {
                IsAlive(true);
                lock (libspotify.Mutex)
                    return(SpotifyLib.Artist.Get(session, libspotify.sp_artistbrowse_similar_artist(artistBrowsePtr, index)));
            });

            _Complete          += new artistbrowse_complete_cb(ArtistBrowse__Complete);
            session.DisposeAll += new SessionEventHandler(session_DisposeAll);
        }
 public static extern IntPtr sp_artistbrowse_create(IntPtr sessionPtr, IntPtr artistPtr, sp_artistbrowse_type type, artistbrowse_complete_cb callback, IntPtr userDataPtr);