Пример #1
0
        /// <summary>
        /// Docks <paramref name="viewHost"/> into this <see cref="IDockHost"/>.
        /// </summary>
        /// <param name="viewHost"><see cref="ViewHost"/> to dock.</param>
        /// <param name="dockResult">Position for docking.</param>
        public void PerformDock(ViewHost viewHost, DockResult dockResult)
        {
            Verify.Argument.IsNotNull(viewHost, "viewHost");

            switch(dockResult)
            {
                case DockResult.Left:
                    viewHost.DockToSide(this, AnchorStyles.Left);
                    if(_status == ViewHostStatus.DockedOnFloat || _status == ViewHostStatus.Floating)
                    {
                        viewHost.Status = ViewHostStatus.DockedOnFloat;
                    }
                    break;
                case DockResult.Top:
                    viewHost.DockToSide(this, AnchorStyles.Top);
                    if(_status == ViewHostStatus.DockedOnFloat || _status == ViewHostStatus.Floating)
                    {
                        viewHost.Status = ViewHostStatus.DockedOnFloat;
                    }
                    break;
                case DockResult.Right:
                    viewHost.DockToSide(this, AnchorStyles.Right);
                    if(_status == ViewHostStatus.DockedOnFloat || _status == ViewHostStatus.Floating)
                    {
                        viewHost.Status = ViewHostStatus.DockedOnFloat;
                    }
                    break;
                case DockResult.Bottom:
                    viewHost.DockToSide(this, AnchorStyles.Bottom);
                    if(_status == ViewHostStatus.DockedOnFloat || _status == ViewHostStatus.Floating)
                    {
                        viewHost.Status = ViewHostStatus.DockedOnFloat;
                    }
                    break;
                case DockResult.DocumentLeft:
                    viewHost.DockToSideAsDocument(this, AnchorStyles.Left);
                    break;
                case DockResult.DocumentTop:
                    viewHost.DockToSideAsDocument(this, AnchorStyles.Top);
                    break;
                case DockResult.DocumentRight:
                    viewHost.DockToSideAsDocument(this, AnchorStyles.Right);
                    break;
                case DockResult.DocumentBottom:
                    viewHost.DockToSideAsDocument(this, AnchorStyles.Bottom);
                    break;
                case DockResult.Fill:
                    viewHost.DockInto(this);
                    Activate();
                    break;
                default:
                    throw new ArgumentException(
                        "Unsupported DockResult value: {0}".UseAsFormat(dockResult),
                        "dockResult");
            }
        }
Пример #2
0
 internal void DockSide(AnchorStyles side, ViewHost host, bool autoHide)
 {
     host.DockToSide(RootControl, side);
 }