/// <summary> /// Shows the window. /// </summary> public static void ShowWindow() { System.Threading.AutoResetEvent windowShown = new System.Threading.AutoResetEvent(false); ExecuteInSTA(() => { Window window = null; try { window = new InteractiveWindow(); window.Show(); windowShown.Set(); var _dispatcherFrame = new System.Windows.Threading.DispatcherFrame(); window.Closed += (obj, e) => { _dispatcherFrame.Continue = false; }; System.Windows.Threading.Dispatcher.PushFrame(_dispatcherFrame); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { windowShown.Set(); } window?.Close(); System.Windows.Threading.Dispatcher.CurrentDispatcher.InvokeShutdown(); }, waitForExecution: false); windowShown.WaitOne(); }
/// <summary> /// Shows the window. /// </summary> public static void ShowWindow() { ExecuteInSTA(() => { Window window = null; try { window = new InteractiveWindow(); window.Show(); var _dispatcherFrame = new System.Windows.Threading.DispatcherFrame(); window.Closed += (obj, e) => { _dispatcherFrame.Continue = false; }; System.Windows.Threading.Dispatcher.PushFrame(_dispatcherFrame); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } window.Close(); }, waitForExecution: false); }
/// <summary> /// Shows the window. /// </summary> public static void ShowWindow() { ExecuteInSTA(() => { Window window = null; try { window = new InteractiveWindow(); window.Show(); var _dispatcherFrame = new System.Windows.Threading.DispatcherFrame(); window.Closed += (obj, e) => { _dispatcherFrame.Continue = false; }; System.Windows.Threading.Dispatcher.PushFrame(_dispatcherFrame); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } window.Close(); System.Windows.Threading.Dispatcher.CurrentDispatcher.InvokeShutdown(); }, waitForExecution: false); }