2013-01-02

Caliburn.Micro Startup Sequence

Caliburn.Micro is a framework for creating MVVM (Model-View-ViewModel) applications using WPF (Windows Presentation Foundation), Silverlight, and other related technologies.
In a WPF application, there is a sequence of methods that are called in the App class (in App.xaml.cs) and the AppBootstrapper class (in AppBoostrapper.cs). For the application I'm working on, I needed to know the order that these methods are called. Since I figure that someone else may want to know that too, I'm documenting it here.
Not all of these methods may exist in your application, since you may not have overridden the methods in the base classes.

  1. static App() constructor is called
  2. Instance App() constructor is called. The InitializedComponent() method of this then calls
    1. static AppBootstrapper() constructor
    2. Instance AppBootstrapper() constructor. The base() method invocation then calls
      1. AppBootstrapper StartRuntime() method. The base.StartRuntime() method invocation then calls
        1. AppBootstrapper SelectAssemblies() method
        2. AppBootstrapper PrepareApplication() method
        3. AppBootstrapper Configure() method
  3. App OnStartup() is called. The base.OnStartup() method invocation then calls
    1. AppBootstrapper OnStartup. The base.OnStartup() method invocation then calls
      1. AppBootstrapper GetInstance() method (possibly multiple times)
      2. AppBootstrapper GetAllInstances() method
At this point the main view should appear. When the application is shutdown, the sequence is:
  1. App OnExit() is called. The base.OnExit() method invocation then calls
    1. AppBootstrapper OnExit()


No comments :

Post a Comment

Note: Only a member of this blog may post a comment.