Menu

#20 Problems with programmatically closing all panels

open
nobody
None
5
2012-01-27
2012-01-27
No

Hi,

I had problems with closing all windows before reloading layout. It turned out that the DockContentCollection was not cleared well. To prevent problems I added a RemoveAll method and improved the existing RemoveContent method.

//veg: 22-12-2008 - Added method to remove all IDockingContent.
// Call before reloading layout.!
//veg: 01-20-2009 - Reordered code to prevent problems with DockState.
public void RemoveAll()
{
for (int i = Count; i != 0; i--)
{
RemoveContent(this[i - 1]);
}
}

//veg: 22-12-2008 - Added Public version of Remove() with some additional cleanup!
public void RemoveContent(IDockContent content)
{
if (content == null)
throw new InvalidOperationException();

Remove(content);

((DockContent)content).DockState = DockState.Unknown;
((DockContent)content).FloatPane = null;
((DockContent)content).DockPanel = null;
((DockContent)content).Pane = null;
}

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.