public void Show(PopupItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            if (this.VerifyIsMessageDialogBox(item))
            {
                throw new Exception($"视图类型 {typeof(MessageDialogBox)} 必须以模态方式进行显示。");
            }

            //堆栈最上层若是模态窗口,则不予显示当前窗口,并激活最上层的模态窗口

            if (this.VerifyTopItemModal())
            {
                if (!this.VerifyIsProcessDialogBox(item))
                {
                    PopupItemContainer container = this.PopupContainerFromIndex(this._popupStack.Items.Count - 1);
                    if (container != null)
                    {
                        container.Flicker();
                    }

                    return;
                }
            }

            if (!this.Contains(item))
            {
                item.VerifyCanShow(this);

                item.InternalShowing(out CancelEventArgs ce);
                if (!ce.Cancel)
                {
                    item._isClosed       = false;
                    item.ParentHostStack = this;
                    this.AddItem(item);
                    item.InternalShown(out EventArgs e);
                }
            }
            else
            {
                this.MoveItemToTop(item);
            }
        }
        public ModalResult ShowModal(PopupItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            if (this.VerifyIsProcessDialogBox(item))
            {
                throw new Exception($"视图类型 {typeof(ProcessDialogBox)} 不可以模态方式进行显示。");
            }

            //以模态显示窗口时,若发现最上层是模态窗口
            //当顶级窗口为MessageDialogBox时不予显示当前窗口
            //当顶级窗口不是MessageDialogBox时,若当前为MessageDialogBox,则显示
            if (this.VerifyTopItemModal())
            {
                if (this.VerifyTopItemIsMessageDialogBox() ||
                    !this.VerifyIsMessageDialogBox(item))
                {
                    PopupItemContainer container = this.PopupContainerFromIndex(this._popupStack.Items.Count - 1);
                    if (container != null)
                    {
                        container.Flicker();
                    }

                    return(null);
                }
            }

            item.VerifyCanShow(this);

            item._showingAsModal = true;
            item._modalResult    = null;
            CancelEventArgs ce = null;

            try
            {
                item.InternalShowing(out ce);
            }
            catch (Exception)
            {
                item._showingAsModal = false;
                throw;
            }

            try
            {
                if (!ce.Cancel)
                {
                    ComponentDispatcher.PushModal();
                    item._dispatcherFrame = new DispatcherFrame();
                    item.ParentHostStack  = this;
                    item._isClosed        = false;
                    this.AddItem(item);
                    item.InternalShown(out EventArgs e);
                    Dispatcher.PushFrame(item._dispatcherFrame);
                    return(item.ModalResult);
                }
            }
            finally
            {
                ComponentDispatcher.PopModal();
                item.InternalDiapose();
            }

            return(null);
        }