public void SlideOut(KryptonPage page, KryptonAutoHiddenGroup group, bool select)
{
// Check to see if we allowed to perform operations
if (Disposing || IsDisposed)
return;
// Move to the hidden state
switch (_state)
{
case DockingAutoHiddenShowState.Hidden:
// Nothing to do, already in state we require
break;
case DockingAutoHiddenShowState.SlidingIn:
// If already showing indicated page (although currently sliding inwards)
if (page == _page)
{
// Switch to sliding out again
_state = DockingAutoHiddenShowState.SlidingOut;
// Are we requested to set focus to the sliding in dockspace?
if (select)
{
DockspaceControl.Select();
DockspaceControl.CellLosesFocus += new EventHandler<WorkspaceCellEventArgs>(OnDockspaceCellLosesFocus);
}
return;
}
else
{
// Different page, so move straight to hidden state
MakeHidden();
}
break;
case DockingAutoHiddenShowState.SlidingOut:
case DockingAutoHiddenShowState.Showing:
// If already showing indicated page (or in the process of showing) then do nothing
if (page == _page)
{
// Are we requested to set focus to the sliding in dockspace?
if (select)
{
DockspaceControl.Select();
DockspaceControl.CellLosesFocus += new EventHandler<WorkspaceCellEventArgs>(OnDockspaceCellLosesFocus);
}
return;
}
else
{
// Different page, so move straight to hidden state
MakeHidden();
}
break;
}
// Cache information about the page being displayed
_page = page;
_group = group;
// Make sure we have a visible cell to update
KryptonWorkspaceCell cell = DockspaceControl.FirstVisibleCell();
if (cell == null)
{
cell = new KryptonWorkspaceCell();
DockspaceControl.Root.Children.Add(cell);
}
// Replace any existing page with the new one
DockspaceControl.ClearAllPages();
cell.Pages.Add(page);
DockspaceControl.PerformLayout();
// Find the starting and ending rectangles for the slide operation
CalculateStartAndEnd();
// Set initial positions of ourself and the contained inner panel
_inner.SetBounds(0, 0, _endRect.Width, _endRect.Height);
SetBounds(_startRect.X, _startRect.Y, _startRect.Width, _startRect.Height);
// Make sure we are at the top of the z-order and visible
_control.Controls.SetChildIndex(this, 0);
Visible = true;
// Switch to new state and start animation timer
_state = DockingAutoHiddenShowState.SlidingOut;
AutoHiddenShowingStateEventArgs args = new AutoHiddenShowingStateEventArgs(_page, _state);
_slideTimer.Start();
// Are we requested to set focus to the sliding in dockspace?
if (select)
{
DockspaceControl.Select();
DockspaceControl.CellLosesFocus += new EventHandler<WorkspaceCellEventArgs>(OnDockspaceCellLosesFocus);
}
// Raises event to indicate change in auto hidden showing state
OnAutoHiddenShowingStateChanged(args);
}