views:

28

answers:

1

I have been playing with the latest templates (patched for Beta tools) and application life cycle. When I was looking for a place to initialize the DispatchHelper, I noticed that the Application_Launching event handler was being executed AFTER the MainViewModel constructor has executed. Is this the expected behavior?

A: 

This entirely depends on how and when you are creating your MainViewModel. If you think about it Launching should not be executed until all static objects and the main application object have been fully constructed.

You many want to delay construction of the MainViewModel until after you know whether you have been launched or re-activated. Even better would be to delay construction of the view model until after you know which page you will be displaying.

Technium