Skip to main content

Microsoft Silverlight

Cancel Image Requests?RSS Feed

(0)

jbaysingar
jbaysingar

Member

Member

72 points

33 Posts

Cancel Image Requests?

Is there a way to cancel a pending image request?

Here's my scenario...

I dynamically add a series of images to a Canvas with remote HTTP URLs. If my control changes state, then I clear the canvas and request a new set of images. The problem is -- if the control changes state before the first set of images are loaded, the requests for the first images stay in the browser's queue (even though they are no longer in the Canvas).  So, the requests for the new images get queued up behind the original requests, and have to wait for the first set to finish loading before they can start loading. This causes an obvious, and unnecessary delay (since the orignal images are no longer needed).

So.... Is there a way to cancel the original set of requests so that the new Images begin loading immediately?



Thx in advance...

J

jasonxz
jasonxz

Participant

Participant

1752 points

530 Posts

Re: Cancel Image Requests?

Well, there are 2 things you can try.

  1. Set the original images to null after removing them from the Canvas.  I don't think this will help, but it's an quick and easy thing to try.
  2. Use an explicit Downloader object to download the images and call the Downloader's Abort() method when you want to remove images prior to the Downloader's Completed event fires.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities