This basic class performs all the initial tasks that are required to start the application, including creating the default RootWorkItem, adding the standard set of services, and loading any services and modules that are defined in the profile or configuration of the application. Call its Run method in your Main routine.
If an area is intended to show a SmartPart that will be added at runtime, you use a SmartPartPlaceHolder control.
If you want to display multiple controls in a container, you can add a workspace.
To create the shell
- Create a new Windows Form application.
- Design the main form as required.
- Add references to the Microsoft.Practices.CompositeUI, Microsoft.Practices.CompositeUI.WinForms, and Microsoft.Practices.ObjectBuilder assemblies.
- Create an application class that specifies the WorkItem to use and the Windows Form to display.
public class MyApplication : FormShellApplication
{
} - Write your Main method, creating the application instance and calling the Run method to start the application running and display the shell form.
To override the AfterShellCreated method
[STAThread]
public static void Main()
{
new MyApplication.Run();
}
protected override void AfterShellCreated()
{
base.AfterShellCreated();
... your start-up code here ...
}
No comments:
Post a Comment