static void TrayAction(object sender, TrayIcon.TrayEventArgs args) { if (MainWnd == null || !MainWnd.FullyLoaded) { return; } switch (args.Action) { case TrayIcon.Actions.ToggleWindow: { if (MainWnd.IsVisible) { MainWnd.Hide(); } else { MainWnd.Show(); } break; } case TrayIcon.Actions.ToggleNotify: { if (MainWnd.notificationWnd.IsVisible) { MainWnd.notificationWnd.HideWnd(); } else if (!MainWnd.notificationWnd.IsEmpty()) { MainWnd.notificationWnd.ShowWnd(); } break; } case TrayIcon.Actions.CloseApplication: { if (Priv10Service.IsInstalled() && AdminFunc.IsAdministrator()) { MessageBoxResult res = MessageBox.Show(Translate.fmt("msg_stop_svc"), App.Title, MessageBoxButton.YesNoCancel, MessageBoxImage.Question); switch (res) { case MessageBoxResult.Yes: if (!Priv10Service.Terminate()) { MessageBox.Show(Translate.fmt("msg_stop_svc_err"), App.Title, MessageBoxButton.OK, MessageBoxImage.Stop); } break; case MessageBoxResult.Cancel: return; } } Application.Current.Shutdown(); break; } } }
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; } } }
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: { Application.Current.Shutdown(); break; } } }