WP7 background threads
Are the threads in a WP7, exist across the app, or are they confined to a page ? Say I started download on a page, which is being handled by a background thread as usual, and its progress is being updated by a status bar. Now the user wishes to use ot开发者_如何学Cher aspects of the application. Will the background thread die if he navigates to another page, either using Application bar controls or back button, to a page within the app ? If not what is a good practice regarding background thread dedicated only to downloads... like if they can exist across the app, should they be initiated when the app is initiated and made to wait until the download queue has a request queued up ?
Thnx
-EgonIf you have a thread that is purely dedicated to downloading an external resource I'd launch this thread at application level. The thread shoudl report progress/completion/etc. to an application level object and not to a specific page. The page shoudl query the app level object if it needs details to display. This way the interactions between pages will have no effect and the data (e.g. download progress) will always be available to whatever page wants it.
The only time I may do this at a page level is if the app only contained a single page but then that's pretty much just the same thing.
精彩评论