/// <summary>
        /// Remove this content from its parent container pane
        /// </summary>
        /// <returns></returns>
        internal DockableContent DetachFromContainerPane()
        {
            if (ContainerPane != null)
            {
                int indexOfContent = ContainerPane.Items.IndexOf(this);
                return(ContainerPane.RemoveContent(indexOfContent) as DockableContent);
            }

            return(null);
        }
예제 #2
0
        /// <summary>
        /// Closes or hides content depending on HideOnClose property
        /// </summary>
        internal virtual bool CloseOrHide(bool force)
        {
            bool closed = false;

            if (!force && !IsCloseable)
            {
                closed = false;
            }
            else if (!force && HideOnClose)
            {
                Hide();
                closed = true;
            }
            else
            {
                if (!CanExecuteCommand(ManagedContentCommands.Close))
                {
                    throw new InvalidOperationException("This operation can be executed in this state");
                }

                CancelEventArgs e = new CancelEventArgs(false);
                OnClosing(e);

                if (e.Cancel)
                {
                    closed = false;
                }
                else
                {
                    if (ContainerPane != null)
                    {
                        ContainerPane.RemoveContent(ContainerPane.Items.IndexOf(this));
                    }

                    //Patch 8244
                    Manager.RemoveContentFromTabGroup(this);

                    OnClosed();
                    closed = true;
                }
            }
            return(closed);
        }
예제 #3
0
        /// <summary>
        /// Closes or hides content depending on HideOnClose property
        /// </summary>
        internal virtual bool CloseOrHide(bool force)
        {
            if (!force &&
                !IsCloseable)
            {
                return(false);
            }

            if (HideOnClose)
            {
                Hide();
                return(true);
            }
            else
            {
                if (!CanExecuteCommand(ManagedContentCommands.Close))
                {
                    throw new InvalidOperationException("This operation can be executed in this state");
                }

                CancelEventArgs e = new CancelEventArgs(false);
                OnClosing(e);

                if (e.Cancel)
                {
                    return(false);
                }

                DockingManager oldManager = Manager;

                if (e.Cancel)
                {
                    return(false);
                }

                ContainerPane.RemoveContent(
                    ContainerPane.Items.IndexOf(this));

                OnClosed();
                return(true);
            }
        }