ModuleController from rootWorkItem WorkItems

Topics: CAB & Smart Client Software Factory
Feb 24, 2006 at 3:02 AM
originally posted by: GiriT


If a ModuleController was in a different project, and you had a reference to that project.. Can you get a reference to the ModuleController that is added to the WorkItems collection of the rootWorkItem?

From one controller I basically want to execute operations on another passing over some parameters to change its behaviour...

I am trying to use the FindByType method on the WorkItems collection but get the following error:

'System.Collections.Generic.ICollection<RootNameSpace.Common.ControlledWorkItem<RootNameSpace.SomeSubNameSpace.ModuleController>>' to 'RootNameSpace.Common.ControlledWorkItem<RootNameSpace.SomeSubNameSpace.ModuleController>'

Am I trying the impossible? On the wrong track? Any other thoughts on how this kind of thing can be accomplished?

Feb 25, 2006 at 12:47 AM
originally posted by: GiriT

Ok, so it turns out that Global scoped events are a great way of doing this, though I would still be interested to know whether i can get a reference to a ModuleController in rootWorkItems.WorkItems collection in the way I originally described. It does tightly couple two modules (which events don't necessarily have to) but if you can live with that then it is something that I can imagine would be useful..
Feb 27, 2006 at 2:14 PM
originally posted by: BradWilsonMSFT

The compiler error in your original post is telling you that FindByType is returning a collection of matching items, not a single item. You need to enumerate over the collection of the matching items.