Ejemplo n.º 1
0
 private void AlbumBrowse__Complete(IntPtr albumBrowsePtr, IntPtr userdataPtr)
 {
     if (albumBrowsePtr == this.albumBrowsePtr)
     {
         this.isComplete = true;
         session.EnqueueEventWorkItem(new EventWorkItem(CreateDelegate <AlbumBrowseEventArgs>(ab => ab.OnComplete, this), new AlbumBrowseEventArgs(this)));
         _Complete -= new albumbrowse_complete_cb(AlbumBrowse__Complete);
     }
 }
Ejemplo n.º 2
0
        protected override void OnDispose()
        {
            _Complete          -= new albumbrowse_complete_cb(AlbumBrowse__Complete);
            session.DisposeAll -= new SessionEventHandler(session_DisposeAll);

            if (!session.ProcExit)
            {
                lock (libspotify.Mutex)
                    libspotify.sp_albumbrowse_release(albumBrowsePtr);
            }

            albumBrowsePtr = IntPtr.Zero;
        }
Ejemplo n.º 3
0
        private AlbumBrowse(Session session, IntPtr albumBrowsePtr)
        {
            if (albumBrowsePtr == IntPtr.Zero)
            {
                throw new ArgumentException("albumBrowsePtr can't be zero.");
            }

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

            this.albumBrowsePtr = albumBrowsePtr;

            this.copyrights = new DelegateArray <string>(() => {
                IsAlive(true);
                lock (libspotify.Mutex)
                    return(libspotify.sp_albumbrowse_num_copyrights(albumBrowsePtr));
            }, (index) => {
                IsAlive(true);
                lock (libspotify.Mutex)
                    return(libspotify.ImageIdToString(libspotify.sp_albumbrowse_copyright(albumBrowsePtr, index)));
            });

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

            _Complete          += new albumbrowse_complete_cb(AlbumBrowse__Complete);
            session.DisposeAll += new SessionEventHandler(session_DisposeAll);
        }
Ejemplo n.º 4
0
 public static extern IntPtr sp_albumbrowse_create(IntPtr sessionPtr, IntPtr albumPtr, albumbrowse_complete_cb callback, IntPtr userDataPtr);
 public static extern IntPtr sp_albumbrowse_create(IntPtr sessionPtr, IntPtr albumPtr, albumbrowse_complete_cb callback, IntPtr userDataPtr);