1 workspace or 2?

Topics: CAB & Smart Client Software Factory
Aug 4, 2006 at 9:46 AM
originally posted by: bil_simser

I'm just wondering what the better design would be here. Here's the scenario.

I'm buildng an app where I have the following:
1 user control containing a tree view
1 user control containing another view

The tree view communicates with the other view via a pub/sub mechanism (when the user selects something in the tree it sends a message to the 2nd view to update the current objects via State).

The question is around structuring the workspaces. I see two designs:

1. Create a new workitem with user control (mainview) that contains a split panel. Each panel contains a deckworkspace/smartpartholder. Create a user control for each view with a MVP attached. Attach each views workitem to the mainview and load the views into the left and right workspaces on the split panel. Load the mainview onto the Layout workspace in the shell.

or.

2. Create the two user controls with views and workitems via MVP. Attach the workitems to the shell and load them into the left and right workspaces.

The second approach is simpler as I don't have to create an additional workspace but it means I wouldn't be able to say swap out the entire interface (both views) if I needed to (or I would have to do a bunch of work to change it). Any reasons why one would be better/worse over another?

Thanks.
Aug 4, 2006 at 7:05 PM
originally posted by: askew

There's lots of options, that's for sure.

If the two user controls are closely related enough, you could bundle them within one View.

WorkItems are 1) the module, 2) the moduleController, n) your additions.
By default, SCSF doesn't generate WorkItems for Views, but you may certainly do so.
WorkItems might be good vehicles for workflow with a set of Views. All within one module.

You can put workspaces on Views, too, so there's support for child Views... all in one WorkItem, perhaps.

  • You can share one Presenter between multiple Views, too.

Lots of options, for sure.

From the help file:

ms-help://MS.VSCC.v80/MS.VSIPCC.v80/ms.scsf.2006jun/SCSF/html/03-080-Workspace%20Hierarchy.htm

"A view (a Windows Form or UI control) contains one or more workspaces. At run time, the application instructs a workspace to show a view. If the view contains its own workspaces, the view instructs those workspaces to show their views. This process continues through the entire hierarchy of workspaces.

"Two types of workspaces provide multiple surfaces that appear in the same location. Only one surface appears at a time. These workspaces are the DeckWorkspace and the TabWorkspace.

"Frequently, workspaces in a view are separated by a movable vertical and horizontal divider. This allows the user to change the ratio of space allocation at run time.

"With this pattern, there is great flexibility in the management of the UI surface. You can create a layout view that defines only a set of workspaces. The application can load other views into those workspaces. By changing the layout view, you can change the appearance and behavior of the client application."