public static void Quit(bool SavedChanges, Window w, bool Load, System.ComponentModel.CancelEventArgs e) { var bericht = MessageBox.Show("Are you sure that you want to leave the editor?", "Quit?", MessageBoxButton.YesNo); if ((bericht == MessageBoxResult.Yes) && SavedChanges == true) { BootWindow win = new BootWindow(); win.Show(); w.Hide(); } else { if (Load == true && (bericht == MessageBoxResult.Yes) && SavedChanges == false) { var mess = MessageBox.Show("You have changes that are not saved, save?", "Save changes?", MessageBoxButton.YesNo); if (mess == MessageBoxResult.Yes) { SaveFile.Save(Load); BootWindow win = new BootWindow(); win.Show(); w.Hide(); } else { BootWindow win = new BootWindow(); win.Show(); w.Hide(); } } else { e.Cancel = true; } } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { var bericht = MessageBox.Show("Are you sure that you want to leave the editor?", "Quit?", MessageBoxButton.YesNo); if ((bericht == MessageBoxResult.Yes) && SavedChanges == true) { BootWindow win = new BootWindow(); win.Show(); this.Hide(); } else { if (Load == true && (bericht == MessageBoxResult.Yes) && SavedChanges == false) { var mess = MessageBox.Show("You have changes that are not saved, save?", "Save changes?", MessageBoxButton.YesNo); if (mess == MessageBoxResult.Yes) { SaveFile.Save(this.Load); BootWindow win = new BootWindow(); win.Show(); this.Hide(); } else { BootWindow win = new BootWindow(); win.Show(); this.Hide(); } } else { e.Cancel = true; } } }
public static void Quit(Window w) { var message = MessageBox.Show("Are you sure that you want to go back to the main screen?", "Return to main", MessageBoxButton.YesNo, MessageBoxImage.Exclamation); if (message == MessageBoxResult.Yes) { w.Hide(); BootWindow window = new BootWindow(); window.Show(); } else { } }