Windows Phone Pitfall: Deployment.Current.Dispatcher

DZone 's Guide to

Windows Phone Pitfall: Deployment.Current.Dispatcher

· Mobile Zone ·
Free Resource
You Windows Phone Developers will be interested to find out about a major pitfall (it might be considered a bug eventually) when you are building a component or application that needs to dispatch messages back to the UI thread.  Here were some of his potential solutions/workarounds to this side effect:

We don't have public access to information about the queued messages in the dispatcher, and of course there's also no way to manually manipulate them. So obviously there are two possible attempts: a) prevent posting to the UI thread once the application gets deactivated, or b) ignore undesired messages posted to the UI thread after activation. Both have a hacky smell to them, but the first one seems more promising. However, I've not yet thought about how this could be handled consistently or if it is possible at all; if I manage to come up with some clean solution, I will do a follow-up post about it.

You can get a full description of this potential pitfall and see example code by following the source link below:

Source: http://www.pitorque.de/MisterGoodcat/post/Windows-Phone-7-Pitfall-The-Dispatcher-and-Deactivation.aspx

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}