Any tutorial on using CreateEachWorkItem ??

Topics: CAB & Smart Client Software Factory
Dec 9, 2005 at 10:29 AM
originally posted by: SUBATBLOOMINGTON

Any tutorial on using CreateEachWorkItem ?? there are no samples in the quickstarts
Dec 11, 2005 at 7:30 PM
originally posted by: headlam

I don’t have a sample to share but you would first need to register the workitem type with the WorkItemTypeCatalogService.

workitemCatalog.RegisterWorkItem<MyWorkItem>( );

Assume MyWorkItem implements IMyWorkItem, you can then create each workitem type that implements IMyWorkItem by provding the type to be created and a delegat callback. You pass this to the CreateEachWorkItem method which calls back with the WorkItem instance. You can then do what you would normally do with the WorkItem (i.e., add a view, show the view in a workspace, etc.).

workitemCatalog.CreateEachWorkItem<IMyWorkItem>(this, delegate(IMyWorkItem workitem)
{
workitem.XXX /// XXX can be a method you implemented on the IMyWorkItem interface
}
);

I know that is not much help, but that is all I can give you at this time.

For more info on anonymous methods see Juval Lowy’s article here http://msdn.microsoft.com/msdnmag/issues/04/05/C20/