This project is read-only.


Apr 21, 2014 at 4:40 PM

I am new to WP8 development, and I've started to build a simple WP8 app using this ImageTools to display gif. Everything works fine. I have a simple page to display gif from a URI, and I have a progress bar to show the download progress of the gif, I update the progress in the DownloadProgress event, it works fine too.

My problem is, during the download progress, halfway downloading the gif, I press the home button to go back to the WP home screen, then I press the back button to go back to the page where the gif is downlading halfway, then I get an System.Net.WebException:

Exception of type 'System.Net.WebException' was thrown.

Stack trace:
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
at System.Net.WebClient.OpenReadAsyncCallback(IAsyncResult result)
Exception of type 'System.Net.WebException' was thrown.

How do I stop the download operation when the app in temporary deactivated for ImageTools? And when the app is activated again, what should I do with the half downloaded gif?

Apr 24, 2014 at 10:13 AM
I figure out a solution for my problem. Using ExtendedImage I can't find anyway to stop the image download when the app is deactivated/tombstoned. And I know that the ExtendedImage is used to download the gif, so instead of using the ExtendedImage, I use WebClient to download the gif file with GetStreamAsync(), and WebClient has a CancelAsync() method, so I just use this method when the app is deactivated.
Marked as answer by ah_lun on 4/24/2014 at 2:13 AM