- Add a Class Library project named MyModule in the solution ShellApplication.sln
- Project's outputpath should be \ShellApplication\bin\Debug\
- In Add Reference Select these three DLLs:
Microsoft.Practices.CompositeUI.dll
Microsoft.Practices.CompositeUI.WinForms.dll
Microsoft.Practices.ObjectBuilder.dll - Add a new class named MyWorkItem.cs
using Microsoft.Practices.CompositeUI;
inherits from WorkItem as below
public class MyWorkItem : WorkItem
{} - Add a class named MymoduleInit.cs
using Microsoft.Practices.CompositeUI;
using Microsoft.Practices.CompositeUI.Services;
using System.Windows.Forms; - inherit from ModuleInit as shown here
public class MyModuleInit : ModuleInit - Add the following variable to reference the WorkItemTypeCatalogService
private IWorkItemTypeCatalogService myCatalogService; - Add the following public property to the class that sets the value of the myCatalogService variable.
[ServiceDependency]
public IWorkItemTypeCatalogService myWorkItemCatalog
{
set { myCatalogService = value; }
} - Override the Load method of the ModuleInit class
public override void Load()
{
base.Load();
myCatalogService.RegisterWorkItem <MyWorkItem>();
}
- inherit from ModuleInit as shown here
- instruct the CAB to load the new module
In the ShellApplication project, open the NewItem dialog box and select XML File. Name it ProfileCatalog.xml.
< ?xml version="1.0" encoding="utf-8" ? >
< SolutionProfile xmlns="http://schemas.microsoft.com/pag/cab-profile" %gt
< Modules >
< ModuleInfo AssemblyFile="MyModule.dll" />
</Modules>
</SolutionProfile> - Save and Run the application
Monday, May 21, 2007
Stage 2: Creating and Loading the Module
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment