Beispiel #1
0
        public IAsyncResult BeginLoadPortraits(Session session, AsyncCallback userCallback, object state)
        {
            ThrowHelper.ThrowIfNull(session, "session");

            int n = LibSpotify.sp_artistbrowse_num_portraits_r(Handle);
            AsyncLoadPortraitsResult result = new AsyncLoadPortraitsResult(n, userCallback, state);

            result.Closure = new List <Image>();

            for (int i = 0; i < n; ++i)
            {
                Image image = new Image(LibSpotify.sp_image_create_r(session.Handle, LibSpotify.sp_artistbrowse_portrait_r(Handle, i)));
                image.Loaded += result.HandleImageLoaded;
                result.Closure.Add(image);
            }

            if (result.CheckComplete())
            {
                result.CompletedSynchronously = true;
            }

            return(result);
        }