private void OnExitButtonClick(object sender, RoutedEventArgs e) { MessageBoxResult askResult = MessageBox.ShowQuestion("Do you want to Exit?", "The scheduler cannot remind you during offline mode!\nYes: Exit (offline mode)\nNo: Minimize to tray (working reminder)\nCancel: Cancel command", true); if (askResult == MessageBoxResult.Yes) { Environment.Exit(0); } if (askResult == MessageBoxResult.No) { WindowState = WindowState.Minimized; } }
protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { //base.OnClosing(e); e.Cancel = true; //Environment.Exit(0); MessageBoxResult askResult = MessageBox.ShowQuestion("Do you want to Exit?", "The scheduler cannot remind you during offline mode!\nYes: Exit (offline mode)\nNo: Minimize to tray (working reminder)\nCancel: Cancel command", true); if (askResult == MessageBoxResult.Yes) { Environment.Exit(0); } if (askResult == MessageBoxResult.No) { WindowState = WindowState.Minimized; } //this.Hide(); // }
private void ShowQuestion_Click(object sender, RoutedEventArgs e) { MessageBox.ShowQuestion("Hello World?", "Is it?"); }