For developers of Windows Phone 7 apps it is important to know all existing concepts of scheduling tasks on Windows Phone 7. At Windows Phone 7 the core threads are the Compositor Thread which interacts with the GPU and the UI Thread. The UI Thread is the main thread, where all your code will normally be executed. But the UI Thread have to handle some important events of the OS and is responsible for the layout management. Therefore it is not a good idea to do heavy actions in the UI thread, because then your app will loose very quickly the “smooth” experience of Windows Phone 7.
The normal way is to create for this heavy operations (parsing JSON, rendering bitmaps, etc.) a new thread directly or using the BackgroundWorker class. An alternative way you can found at
Instead of using the direct ways for new thread creation, you could use the built-in scheduling mechanism which are in the namespace Microsoft.Phone.Reactive. The Scheduler class in this namespace allows you to defer execution of pretty much everything you need. You can either directly operate with Scheduler or via IScheduler, that will get a thread instance from Scheduler.
Keine Kommentare:
Kommentar veröffentlichen