protected bool AskAndSave(bool saved) { if (_saveEnabled) { var result = DialogResult.None; if (IsDirty) { result = MessageBox.ShowYesNo(BaseFormMessages.SaveDataQuestion, BaseFormMessages.Save); } if (result == DialogResult.Yes) { saved = Save(); } else if (result == DialogResult.Cancel) { saved = false; } } else { saved = true; } return(saved); }
private bool DoSave() { bool doSave = true; if (IsDirty) { if (!Focused) { Focus(); } DialogResult dr = MessageBox.ShowYesNo(BaseFormMessages.SaveDataQuestion, BaseFormMessages.Save); switch (dr) { case DialogResult.Yes: doSave = Save(); break; case DialogResult.No: break; case DialogResult.Cancel: doSave = false; break; default: doSave = false; break; } } return(doSave); }
public override void Execute() { IList <FrmBase> dirtyForms = WindowManager.FindDirtyWindows(); if (dirtyForms != null && dirtyForms.Count == 0) { WindowManager.CloseAllForms(); ApplicationExit = true; } else { string formInfo = string.Empty; foreach (FrmBase form in dirtyForms) { formInfo += form.Text + Environment.NewLine; } DialogResult = MessageBox.ShowYesNo("Möchten Sie wirklich die Anwendung beenden?" + Environment.NewLine + "Sie haben noch folgende Fenster nicht gespeichert." + Environment.NewLine + Environment.NewLine + formInfo, "Anwendung beenden"); if (DialogResult == DialogResult.Yes) { WindowManager.CloseAllForms(); ApplicationExit = true; } else { ApplicationExit = false; } } }
protected virtual bool Confirmation() { var dr = MessageBox.ShowYesNo(CommandRes.DeleteConfirmation, CommandRes.DeleteEntry); return(dr == DialogResult.Yes); }