May 1, 2012 at 9:08 PM
Edited May 1, 2012 at 9:08 PM
|
I'm having some issues with my CanClose not working as expected. I have a butchered version of the HelloScreens application with a hierarchy much like this:
Shell<IWorkspaceViewModel>
IWorkspaceViewModel + WorkspaceManagerViewModel<IScreen>.Collection.OneActive
Screen
What is happening is I am trying to close the active WorkspaceViewModel from the shell. It should in theory be calling CanClose all the way up the tree and make sure that it doesn't close if I have pending saves on a screen.
My Close button does:
Shell.ActiveItem.TryClose()
IWorkspaceViewModel.CanClose(callback)
WorkspaceManager.CanClose(callback)
ConductorWithCollectionOneActive.CanClose(callback)
Screen1.CanClose(callback) -> IsDirty ? callback(messageCanClose==Okay) : callback(true) (true)
Screen2.CanClose(callback) -> IsDirty ? callback(messageCanClose==Okay) : callback(true) (true)
Screen3.CanClose(callback) -> IsDirty ? callback(messageCanClose==Okay) : callback(true) (false)
When one of my screens (screen3) actually triggers the popup message because it is dirty I expected the entire hierarchy to stick around. What is happening is everything is closing and disappearing, then my popup message fires, and I can say yes/no.
I end up back at the prior activated WorkspaceView in my shell's conductor.
If I say No then everything is still gone but when I re-open the window's state is as it was. If I say Yes then everything is gone as expected.
My problem is I cannot figure out why the the Workspace View is closing before I get the confirmation from the nested children that it is okay to fire.
I can debug through and see the Conductor CanClose logic fire..
Any ideas? I thought that just passing the CanClose() on to the WorkspaceManager conductor would do the trick.
thanks
jack
|