public static void StopEngine() { client.Quit(); client.Close(); if (!EngineProc.WaitForExit(30000)) { EngineProc.Kill(); } EngineProc = null; }
static void TrayAction(object sender, TrayIcon.TrayEventArgs args) { switch (args.Action) { case TrayIcon.Actions.ToggleWindow: { if (mMainWnd.IsVisible) { mMainWnd.Hide(); } else { mMainWnd.Show(); } break; } case TrayIcon.Actions.CloseApplication: { if (svc.IsInstalled()) { MessageBoxResult res = MessageBox.Show(Translate.fmt("msg_stop_svc"), App.mName, MessageBoxButton.YesNoCancel, MessageBoxImage.Question); switch (res) { case MessageBoxResult.Yes: if (!client.Quit()) { MessageBox.Show(Translate.fmt("msg_stop_svc_err"), App.mName, MessageBoxButton.OK, MessageBoxImage.Stop); } break; case MessageBoxResult.Cancel: return; } } Application.Current.Shutdown(); break; } } }