private void Window_Closing(object sender, CancelEventArgs e) { ExecuteWindowBehavior(App.Settings.ExitBehavior); if (ignoreclose) { e.Cancel = true; } else { NotifyIcon.Visibility = System.Windows.Visibility.Hidden; state.Shutdown(); Environment.Exit(0); } }
public void Shutdown() { System.Threading.Tasks.Task.Factory.StartNew(new Action(() => { System.Threading.Thread.Sleep(2500); State.Shutdown(); App.Current.Dispatcher.Invoke(new Action(() => { App.Current.Shutdown(0); })); })); }