topher-b
9/4/2014 - 6:30 PM

WPF Modal Dialog

WPF Modal Dialog

After you make your dialog you will run into a problem with returning data. The code process will not want to stop and wait for a button to be pressed. The solution to this is to add the following to create a pause.

while (AlertIsUp)
            {
                if (this.Dispatcher.HasShutdownStarted ||
                    this.Dispatcher.HasShutdownFinished)
                {
                    break;
                }

                this.Dispatcher.Invoke(
                    DispatcherPriority.Background,
                    new ThreadStart(delegate { }));
                Thread.Sleep(20);
            }