I have used the web client method to download images using a background worker in my wp7 app. I came to know the webclient method usually run in the UI thread by default. So now there is a confusion that wheather the webclient run in the backround thread or UI thread in the app even if it is mention inside the background worker class
Share
The execution of a
WebClientrequest will run on the thread it is called on, unless it has a Async suffix at the end of it’s method name. (For exampleDownloadData(Uri)will run on the same thread as the call.DownloadDataAsync(Uri)will run on a new background thread)If you’re using a
BackgroundWorkerto call your WebClient requests it will not be executed on the UI thread (Both using theDownloadandDownloadAsyncmethods), becauseBackgroundWorkeralready runs it’s code in a background thread in the first place.EDIT: Looking at your tags, it should be noted that Silverlight (and thereby Windows Phone 7) only supports the Async versions of the
WebClientcalls.