Create the first composite WPF application
1. Prerequisite Conditions:
You need to download to CAL (Composite application Library) libraries, which are actually several DLL files that will be referenced in the project to build our program, which you can download from here. Of course, you also need an IDE that can build WPF applications, such as VS2008.
2. Create Shell Project
2.1. Create a new WPF application in VS, add the Cal library file to the project reference
2.2. Rename the auto-generated Window1 main window and its corresponding file to the shell, which will serve as the shell for our composite app.
2.3. Creating bootstrapper, customizing how the program is initialized
Create a new Bootstrapper class to inherit from Unity Bootstrapper, and rewrite some of these methods to implement our custom
Internal class Bootstrapper:unitybootstrapper
{
protected override DependencyObject Createshell ()
{
var shell = new Shell ();
Shell. Show ();
return shell;
}
protected override Imoduleenumerator Getmoduleenumerator ()
{return
new Staticmoduleenu Merator ();
}
}
We specify our shell by rewriting the Createshell () method, by overriding the Getmoduleenumerator () method to specify the way our module is loaded (here, in order to compile it, We're going to return to a staticmoduleenumerator, and we'll explain how to configure the module's loading using a configuration file.