Smart part from another module

Topics: CAB & Smart Client Software Factory
Mar 30, 2006 at 9:34 PM
originally posted by: mojsony

Hi all,

I need help on fillowing...

Assume I have 2 modules "Statement Managament", and "Report Center".
I want to display Smart Part from "Report center" module (Smart part wher I can choose already defined statement reports) in SingleStatementView (located in "Statement managament" module).

So, if decide that one should not have report center that smart part will not be displayed.

Any code samples would be nice ..


Mar 30, 2006 at 11:10 PM
originally posted by: davidlaribee

This code should allow you to determine if a specific module is loaded at run time. This would live from whatever workitem, your shell, etc... (it assumes RootWorkItem exists as a property of the object that contains this code).

IModuleLoaderService moduleLoaderService =

bool userHasReportCenter = false;

foreach (LoadedModuleInfo moduleInfo in moduleLoaderService.LoadedModules)
if (moduleInfo.Name == "ReportCenter")
userHasReportCenter = true;

This assumes you've added the "ModuleAttribute" in your module's AssemblyInfo (otherwise you will need to use as standard, fully qualified assembly name), e.g.:

assembly: Microsoft.Practices.CompositeUI.Module("ReportCenter")

You could also use IWorkItemTypeCatalogService with a specialized interface... this might give you a less imperative and more "plugin-based" approach if that's important to you. Check out the BankTeller sample app's IShowInWorkspace for an example of how to set this up.
Apr 1, 2006 at 4:20 AM
originally posted by: mojsony


Your post was usefull in determination of module existance.

More "plugin-based" approach is exactly what I need.

If you (or someone has code example) for use of IWorkItemTypeCatalogService

"if you want to show SmartPart from another module, SmartPart need to be in RootWorkItem."
Is this correct?

Apr 6, 2006 at 1:58 PM
originally posted by: davidlaribee

See this thread:
Apr 6, 2006 at 10:14 PM
originally posted by: mojsony

Thanks a lot

Thats it.