예제 #1
0
        /// <summary>
        /// Shows the flyout on a <see cref="FlyoutContainer"/>.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <exception cref="System.ArgumentNullException">container</exception>
        public virtual void ShowDialog(FlyoutContainer container)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            container.Show(this);
            _isOpen        = true;
            _diaglogResult = null;
        }
예제 #2
0
        /// <summary>
        /// Shows the flyout on a <see cref="FlyoutContainer"/>.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <exception cref="System.ArgumentNullException">container</exception>
        public virtual bool?ShowDialogModal(FlyoutContainer container)
        {
            ShowDialog(container);

            while (_isOpen)
            {
                // from http://www.codeproject.com/Articles/36516/WPF-Modal-Dialog
                // HACK: Stop the thread if the application is about to close
                if (this.Dispatcher.HasShutdownStarted ||
                    this.Dispatcher.HasShutdownFinished)
                {
                    break;
                }

                // HACK: Simulate "DoEvents"
                //this.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { }));
                this.Dispatcher.DoEvents();
                Thread.Sleep(20);
            }

            return(DialogResult);
        }