skip to main |
skip to sidebar
Stage 2: Creating and Loading the Module
- Add new Class Library project named MyModule to the existing solution
- In Properties->Build->Output select \bin\Debug folder of ShellApplication project
- Save and reopen then, Properties->Outputpath to ..\ShellApplication\bin\Debug
- Add Reference
Microsoft.Practices.CompositeUI.dll
Microsoft.Practices.CompositeUI.WinForms.dll
Microsoft.Practices.ObjectBuilder.dll
- Create a class named MyWorkItem.cs derived from WorItem and include namespace
using Microsoft.Practices.CompositeUI;
public class MyWorkItem : WorkItem
{
}
- Add a module Initialiser
- add class named MyModuleInit.cs derived from ModuleInit and include namespaces
using Microsoft.Practices.CompositeUI;
using Microsoft.Practices.CompositeUI.Services;
using System.Windows.Forms;
public class MyModuleInit : ModuleInit
{
}
- Add the following variable to reference the WorkItemTypeCatalogService so that you can access it to register your WorkItem:
private IWorkItemTypeCatalogService myCatalogService;
[ServiceDependency]
public IWorkItemTypeCatalogService myWorkItemCatalog
{
set { myCatalogService = value; }
}
- Override the Load method of the ModuleInit class so that it registers your module's WorkItem.
public override void Load()
{
base.Load();
myCatalogService.RegisterWorkItem<MyWorkItem>();
}
- instruct the CAB to load the new module in ProfileCatalog.xml.
<?xml version="1.0" encoding="utf-8" ?>
<SolutionProfile xmlns="http://schemas.microsoft.com/pag/cab-profile">
<Modules>
<ModuleInfo AssemblyFile="MyModule.dll" />
</Modules>
</SolutionProfile>
right-click the file ProfileCatalog.xml and click Properties. Change the Copy To Output Directory property to Copy Always.
No comments:
Post a Comment