Sunday, May 20, 2007

Stage 1: Creating the Shell and the Form

  1. create a new application named ShellApplication.sln
  2. In Add Reference Select these three DLLs:
    Microsoft.Practices.CompositeUI.dll
    Microsoft.Practices.CompositeUI.WinForms.dll
    Microsoft.Practices.ObjectBuilder.dll
  3. Create a form named ShellForm.cs
  4. Create a WorkItem
    • Create a class named ShellWorkItem.cs
      using Microsoft.Practices.CompositeUI
    • ShellWorkItem class inherits from WorkItem as shown
      public class ShellWorkItem : WorkItem
      {}
  5. rename the file Program.cs to ShellApplication.cs and open it.
    using Microsoft.Practices.CompositeUI.WinForms;
    • Replace the static class ShellApplication with a public class that inherits from FormShellApplication as below
      public class ShellApplication : FormShellApplication < shellworkitem, ShellForm>
    • Change the static Main method as follows
      [STAThread]
      static void Main()
      {
      new ShellApplication().Run();
      }
  6. Save and Run the application

No comments: