Quantcast
Channel: devforcecaliburn Wiki Rss Feed
Viewing all articles
Browse latest Browse all 20

Updated Wiki: The Application Bootstrapper

$
0
0

The Application Bootstrapper

Context

Any application needs to start up somehow. Application bootstrapping is the process of initializing the application and displaying the root view model.

Bootstrapping an Application

Bootstrapping an application in the DevForce Application Framework is accomplished by means of a bootstrapper class created as a static resource in the applications’s App.xaml. The bootstrapper class is created by extending the generic class FrameworkBootstrapper<TRootModel>.

The bootstrapper needs the type of the ViewModel that represents the first screen the user should see. The ViewModel must be decorated with the proper MEF export attribute in order for the bootstrapper to create an instance through MEF.

public class AppBootstrapper : FrameworkBootstrapper<MainViewModel>
{
    // Add additional logic if required. 
}

Then all that needs to be done is to create a static resource from the bootstrapper:

<Application x:Class="SampleApplication.App" 
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             xmlns:app="clr-namespace:SampleApplication;assembly=SampleApplication.SL"><Application.Resources><app:AppBootstrapper x:Key="Bootstrapper" /></Application.Resources></Application>

Viewing all articles
Browse latest Browse all 20

Latest Images

Trending Articles





Latest Images