Same smartparts used in different views??

Topics: CAB & Smart Client Software Factory
Sep 18, 2007 at 1:32 AM

Does anyone has any suggestions on this?

1) I have my layout view separated from my shellform and the layout view will contain a deckworkspace.
2) I want to create 3 modules (for now) and each of these modules will contain a view. The view will contain multiple workspaces i.e. deck & tab.
3) Various modules containing views will be loaded in the workspaces from 2.

Assume for simplicity sake, I have module 1 & module 2, both containing workspace1 & workspace2 respectively. Finally I have for example a treeview folder (like in windows explorer) called folderView.

What I want is to load module 1 by default in the layout view deckworkspace. Its workspace i.e. Workspace 1 will load the folderView.

Now the part I need to find out about:

A user clicks on a button on the main toolbar, I want to hide/close (preferrably) module 1 which is contained in the layout view (which in turns will close folderView) and I want to show/load module 2, which in turn will load folderView in workspace2 respectively.

Is it possible to use folderView in multiple workspaces used by different modules?

Am I making any sense?


Sep 18, 2007 at 2:21 PM
Do you want to show the same smartpart in different workspaces spread accross different modules?

Yes, it makes sense. Though, I should use a separate instance of the smartpart for each workspace. Since your views are stateless (they'd better be), it should not be an issue to have multiple instances of the smartpart (view), you can also (optionally) share a presenter among multiple smartparts (folderView's). E.g. you can have single presenter, and multiple smartparts.
Sep 18, 2007 at 4:12 PM

I believe that I don't understand the context absolutely.

What I would do if I have a view shared by all the modules, is to decouple it from each module and to place it, for example, in the shell. Therefore it would not need to be hiding and showing the view whenever the modules are loaded. You can then handle the interaction with your modules via the EventBroker.

Please let me know if this helps!

Mariano Converti
Sep 18, 2007 at 11:13 PM

Thanks for getting back to me. I've started playing around and I think I'll be able to achieve it, but I may repost something.

I've posted a quick graphic of what I'm trying to achieve @

maybe it will make more sense on what I'm trying to achieve. Each of the modules, while using of identical views are completely independ from one another and could easily be different application, but I want to keep them in the same application but simply using scfs this time around.

Have a look and see if it makes any sense.

I'll try to do what you've said about using the separate instance. This should save me having to load/unload but what about memory? As only one module will be displayed at a time, will this consume a lot more RAM when module1 has been loaded and made visible and then switching to module 2, it will go where? Will simply be hidden or does it get unloaded? Don't forget they get shown on on mainWorkspace.





Sep 19, 2007 at 12:11 AM
Hi again,

OK, now I'm really confused. I thought I understood that the idea of using a different variable, but now that I've created a dummy viewer module (with a view), I suddendly remember that the code to load this view in a specific module is held within this module, so how do I load my viewer (view) into module 1 workspace and how do I load it in module 2 workspace.

Note that both workspace in both modules have the same name?? Is this an issue.

Am I suppose to modify the function ShowViewInWorkspace(Of ViewerView)(WorkspaceNames.ViewWorkspace) called in the module controller? but since the workspaces have the same name, but are held in different views in different modules, how do I know which module to call? Events??? Should I consider renaming the name spaces?

Am I to create 2 different variable in the module controler of the viewer module?

Sorry about all the questions!!


Nov 21, 2007 at 5:00 PM
Guys, any resolution to this issue? I also have a requirement to show the same smartpart in different workspaces spread accross different modules.
I dont know about creating a special view Module just for shared Views...
Any other ideas??