Deckworkspace Multiple Views with state

Topics: CAB & Smart Client Software Factory
Feb 6, 2006 at 7:52 AM
originally posted by: David_Martin

I now believe that if I get stumped, the best way to figure it out on my own is to ask the question. Not long after asking I figured this one out. I think. I'm using the workItem.Items.Get<MyFirstView>("someKeyValue");

I'm new to CAB and trying to understand something about workspaces and views. I have heard the deck workspace compared toa deck of cards, and at first it made sense. Now I'm not so sure. I have one deck workspace. Into that workspace I place a single view. The user makes edits to fields in such a way that I need to now show a second view on top of the first. When I return to the first all of the edits are gone.

What is the proper way to re-show the same first view?

Here is what I have so far:

2 views/smart parts.
1 presenter.

The presenter maintains a reference to both views. Based on events, the presenter will call:
public void OnShowFirstView(object sender, EventArgs e)
if ( myFirstView == null )
myFirstView = workItem.Items.AddNew<MyFirstView>();


I've also tried .Activate(myFirstView) on that last line. Each one causes the Load event in the view to fire - the view looks and behaves as though it is being shown for the first time.

I hope all that makes sense.