Switching between work items

Topics: CAB & Smart Client Software Factory
Apr 2, 2007 at 10:20 AM
Hi All

I'm new to the CAB and trying to do some simple stuff - at least it should be simple...

If I have a module and I have two work items, each with their own view, I'm wanting to respond to a command (i.e. I've created my menus and have a CommandHandler method which is being called appropriately) and switch to a different work item.

Can somebody give me some example code of how this might work? I have created my Shell Form and have put a DeckWorkspace on my form. From what I'me seeing at the moment, only the last WorkItem that I've callled Run() on actually shows.

TIA

Craig
Apr 2, 2007 at 3:04 PM
Hello.

It's very simple. I think you've added two workitems with their own views, and lastly added workitem is being showed.

For switching between WorkItems, you shoud switch between theis views, so in command handler you have to recover the apropiate view and show it.

For example, for showing view 1 of workitem 1.

IView1 _view1 = WorkItem.Items.Get<IView1>("View1");
if (_view1 != null)
WorkItem.RootWorkItem.WorkspacesWorkSpaceNames.DeckWorkspace.Show(view1);

This is a very simple example, but I hope it puts you in the correct way.

Regards!