views:

87

answers:

1

I have an app built with the Silverlight Navigation Application Template.

I have a main form (e.g. MainPage.xaml) and a bunch of Silverlight Pages, which are swapped in and out of the main content area.

In the MainPage.xaml, I have a DispatcherTimer which hits some Uri resources, regardless of which page I am on. Every now and then, it will inexplicably stop firing.

I have an inkling that it has to do with the scope of various pages. Can pages inside the MainPage.xaml take away the scope from its parent?

Or is this something much simpler?

+1  A: 

It is much simpler, if you're using the DispatcherTimer, which runs on the Dispatcher thread (xaml), which is the thread used to build the UI, then the Timer wont fire when it is being blocked by another action running on the same thread.

This action could be the previous WebGet call (unlikely since those would be async calls) or more likely what your're doing with the return values might be time consuming, or some pages might require more time than others to build their UI content, hence the Dispatcher event might get queued and fire when the thread is free.

I Suggest you follow the MVVM architectural style of building Silverlight applications, by doing this you can run your timer and WebGet calls from your ViewModel which runs on a different thread, which is unaffected by the UI, hence unaffected by the transition of pages.

Neil