public IAsyncResult BeginLoadImage(Session session, AsyncCallback userCallback, object state) { byte[] imageId = new byte[20]; bool hasImage = LibSpotify.sp_playlist_get_image_r(Handle, imageId); if (!hasImage) { AsyncLoadImageResult result = new AsyncLoadImageResult(userCallback, state); result.CompletedSynchronously = true; result.SetCallbackComplete(); result.SetCompleted(Error.Ok); return(result); } IntPtr p = System.Runtime.InteropServices.Marshal.AllocHGlobal(imageId.Length); try { System.Runtime.InteropServices.Marshal.Copy(imageId, 0, p, imageId.Length); return(ImageLoader.Begin((ptr, size) => { return ptr; }, p, session, ImageSize.Normal, userCallback, state)); } finally { System.Runtime.InteropServices.Marshal.FreeHGlobal(p); } }
public IAsyncResult BeginLoadPortrait(Session session, ImageSize size, AsyncCallback userCallback, object state) { return(ImageLoader.Begin(LibSpotify.sp_artist_portrait_r, Handle, session, size, userCallback, state)); }
public IAsyncResult BeginLoadImage(Session session, AsyncCallback userCallback, object state) { return(ImageLoader.Begin((p, s) => { return p; }, ImageId, session, ImageSize.Normal, userCallback, state)); }