Access the Workspaces between modules

Topics: CAB & Smart Client Software Factory
Dec 11, 2007 at 2:18 AM
I have created a SCSF solution with a few modules. But I got some problems when I tried to access menu item / workspaces between modules.

Currently I have a Shell Form in the Infrastructure. Then I create a new module (Module1.dll) and extend the menu from the Shell Form. It is no problem for this part.

ToolStripMenuItem menuItem = new ToolStripMenuItem();
menuItem.Text = "Menu 1";
WorkItem.UIExtensionSitesUIExtensionSiteNames.FileMenuItem.Add(menuItem);
WorkItem.UIExtensionSites.RegisterSite(UIExtensionSiteNames.Menu1, menuItem.DropDownItems);

Then I want to create another module (Submodule1_1.dll) to extend the menu based on my "Menu 1".

ToolStripMenuItem menuItem = new ToolStripMenuItem();
menuItem.Text = "Sub Menu 1-1";
WorkItem.UIExtensionSitesUIExtensionSiteNames.Menu1.Add(menuItem);

Problem occurs here. I can only get the Workspaces or UIExtensionSites of the Shell Form. I can't find the Workspaces that I created from Module1.dll. So does anyone know how can I expose the workspaces of my new created modules to other modules? or what is the proper way to handle this...? Thanks!
Dec 11, 2007 at 1:49 PM
You have the following hierarchy:

  • Shell
    • Module1
    • Submodule1_1
Basically, your FileMenuItem site is in the WorkItem collection of the Shell (which is the RootWorkItem), and your Menu1 site is in the WorkItem of Module1. Because WorkItems are hierarchical, you can get to FileMenuItem site because it is in the RootWorkItem, which is the parent of the WorkItem for Module1. You cannot get to the Menu1 site from Submodule1_1 because they are two different WorkItems in the same level of the hierarchy. If you need to be able to access the UIExtensionSite you create in Module1 from anywhere else other than Module1, you'll need to register that site in the RootWorkItem so both modules can access it.

Kyjan
Dec 11, 2007 at 3:04 PM
Edited Dec 11, 2007 at 3:05 PM
Thanks! Is it possible in SCSF to make the hierarchy like this:
Level 1: Shell
Level 2: >>Modules1
Level 3: >>>>Submodule1_1

I want to make Submodule1_1 to extend features from Modules1 instead of make chagnes from the Shell, because I don't want to change the code at Root level when I implement Modules1 and its submodules... How can it works using SCSF...?


Kyjan wrote:
You have the following hierarchy:

  • Shell
    • Module1
    • Submodule1_1
Basically, your FileMenuItem site is in the WorkItem collection of the Shell (which is the RootWorkItem), and your Menu1 site is in the WorkItem of Module1. Because WorkItems are hierarchical, you can get to FileMenuItem site because it is in the RootWorkItem, which is the parent of the WorkItem for Module1. You cannot get to the Menu1 site from Submodule1_1 because they are two different WorkItems in the same level of the hierarchy. If you need to be able to access the UIExtensionSite you create in Module1 from anywhere else other than Module1, you'll need to register that site in the RootWorkItem so both modules can access it.

Kyjan

Dec 11, 2007 at 4:19 PM
To do what you're wanting to do, I think you would have to create a WorkItem under the Module1 WorkItem. Submodule1_1 would no longer be a module. I'm not aware of another way to do that. If anyone else is aware of a way, I'd be interested to know myself.

Kyjan