Here's one to exercise the ageing grey matter...
I have 5 modules...
Modules A and B are in essence user controls. They are frame/border less UIs responsible for independant areas of functionality.
The things is, in certain situations I want/need to present those 2 UIs as dockable windows/panels in the shell whilst in other situations I need those UIs to be presented side by side in a dialog box.
The view for ModuleAPanel simply provides RegionA (the region where ModuleA will register it's view) in a DockableContent control.
That view is then subsequently injected into a defined region in the shell; "LeftEdge".
The view for ModuleBPanel simply provides RegionB (the region where ModuleB will register it's view) in a DockableContent control.
That view is then subsequently injected into a defined region in the shell; "RightEdge".
As for ModuleAndBDialog, the view here is actually a new window (that's going to be the dialog) with 2 content controls on it, 1 for RegionA and 1 for RegionB.
Clearly, this view doesn't get injected into the shell, as it needs to popup.
(I have code that handles all of that, that's not the problem).
The problem basically boils down to the difference in presentation styles.
A dockable window/panel similar to those in Visual Studio is somewhat different to a modal dialog and probably the most significant difference is being able to Cancel the dialog.
Clearly, if you cancel the dialog you need to rollback any changes you made to the data since you opened it.
I've been reading into IEditableObject which I think is a start.
I could make my ModuleA and ModuleB both implement this interface and hence provide BeginEdit, CancelEdit and EndEdit functionality.
ModuleAPanel and ModuleBPanel would simply ignore all of these methods which is no big deal, you can't cancel a panel so the idea of a transaction doesn't apply.
In the case of ModuleAandBDialog, that would need to call BeginEdit when the dialog was shown and CancelEdit if it was cancelled or EndEdit if it was okay'd.
The problem is though, ModuleAandBDialog literally just provides a window with 2 named regions.
It has no idea what we're going to put in those regions, so how can I wire up the Begin,Cancel and EndEdit actions?
I think I'm almost there, but there's just the final piece of the puzzle I'm not seeing right now.
So that's where you guys come in, I need a fresh pair of eyes please!
Anyone done this before? or think they know how to do it?
Thanks in advance...