Hello,
I am using the UltraDockManager but I'm having a small problem with removing workspaces. I support multiple layouts in my application which makes me want to be able to save and unload the information available in the docking manager to load it with new information. I found that upon closing a workspace it gets status hidden, but doesn't get removed from the DockManager. This is impracticle, because I don't want extra information in my dock manager when I save it.
To resolve the issue I added a listener to PropertyChanged in DockableControlPane and made this.Control.Dispose() followed by this.Dispose if propId == PropertyIds.Closed. This actually worked according to my needs, until I ran my unit test which threw an exception at the this.Control.Dispose(). Do you have any tips on how to get the workspace dissappear from my manager without making my unit test fail? The exception was a NullReferenceException, the stack trace follows:
at Infragistics.Win.UltraWinDock.UltraDockManager.DestroyControl(Control control) at Infragistics.Win.UltraWinDock.UltraDockManager.RemoveControlPaneContainer(DockableControlPane pane) at Infragistics.Win.UltraWinDock.UltraDockManager.ControlPaneRemoved(DockableControlPane pane) at Infragistics.Win.UltraWinDock.DockableControlPanesCollection.Remove(DockableControlPane pane) at Infragistics.Win.UltraWinDock.DockableControlPane.OnControlDisposed(Object sender, EventArgs e) at System.ComponentModel.Component.Dispose(Boolean disposing) at System.Windows.Forms.Control.Dispose(Boolean disposing) at System.ComponentModel.Component.Dispose() at <some namespace>.PropertyChanged(PropertyIds propId)
This looks like a bug. I would recommend submitting it to the support group: http://www.infragistics.com/gethelp. To work around the issue, try removing the control pane from the dock manager before disposing the control:
this.ultraDockManager1.ControlPanes.Remove( panel1 );
Thank you for the quick reply. I tried the workaround, but unfortunatly it didn't work, I get the same exception, same stack trace. I must underline that this code works perfectly fine when running the program, it is only when running unit tests, where the workspaces for example doesn't become visible that I get the exception.
This is the property changed method:
{
}
I tried using similar code in a unit test but was unable to reproduce the issue. The only other thing I can think of to work around this would be to add a call to Application.DoEvents() after removing the pane and before disposing the control. It's possible something is being cleaned up aschronously after removing a pane and that would allow it to clean up properly before the control is disposed though.