Monday, May 28, 2007

Basic Commands

UI Elements.
RootWorkItem.UIExtensionSites.RegisterSite(“FileMenu”, Shell.MainMenuStrip);


ToolStripMenuItem printItem = new ToolStripMenuItem("Print");
RootWorkItem.UIExtensionSites[“FileMenu”].Add(printItem);
WorkItems.
adding services to a workitem. ie creates an instance
WorkItem.Services.AddNew<CustomerFinderService, ICustomerFinderService>();
creates an instance of the OfficerView class
WorkItem.SmartParts.AddNew<OfficerView>();
get another component in a workitem
ICustomerFinderService customerFinderServcie =
WorkItem.Services.Get<ICustomerFinderService>();

EVents.
publishing
[EventPublication("topic://UpdatesAvailable", PublicationScope.Global)]
public event EventHandler<DataEventArgs<UpdateData>> UpdatesAvailable;
// or
[EventPublication("topic://UpdatesAvailable", PublicationScope.Global)]
public event EventHandler UpdatesAvailable;
subscription
[EventSubscription("topic://UpdatesAvailable")]
public void SomethingHappened(object sender, DataEventArgs<UpdateData> e)
{ ... }

Module.
Module Dependencies
[assembly: ModuleDependency("BranchSystems.Module")]
Loading Modules- default file is ProfileCatalog.xml
<?xml version="1.0" encoding="utf-8" ?>
<SolutionProfile xmlns="http://schemas.microsoft.com/pag/cab-profile" >
<Modules>
<ModuleInfo
AssemblyFile="GlobalBank.AppraiserWorkbench.AppraiserWorkbenchModule.dll" /></Modules></SolutionProfile>
services.
Registering a service
[Service(typeof(IMyService))]
public class MyService : IMyService
{
}

Locating a Service.
private IMyService service;

[ServiceDependency]
public IMyService MyService
{
set { service = value; }
}


No comments: