public DockPane SetDockState(DockState value)
{
if (value == DockState.Unknown || value == DockState.Hidden)
throw new InvalidOperationException(Strings.DockPane_SetDockState_InvalidState);
if ((value == DockState.Float) == this.IsFloat)
{
this.InternalSetDockState(value);
return this;
}
if (this.DisplayingContents.Count == 0)
return null;
IDockContent firstContent = null;
for (int i = 0; i < this.DisplayingContents.Count; i++)
{
IDockContent content = this.DisplayingContents[i];
if (content.DockHandler.IsDockStateValid(value))
{
firstContent = content;
break;
}
}
if (firstContent == null)
return null;
firstContent.DockHandler.DockState = value;
DockPane pane = firstContent.DockHandler.Pane;
this.DockPanel.SuspendLayout(true);
for (int i = 0; i < this.DisplayingContents.Count; i++)
{
IDockContent content = this.DisplayingContents[i];
if (content.DockHandler.IsDockStateValid(value))
content.DockHandler.Pane = pane;
}
this.DockPanel.ResumeLayout(true, true);
return pane;
}