public bool PromptSave() { if (Document?.IsModified == true) { var result = MessageBox.Show(this, "The current file has been modifieded. Do you wish to save?", MessageBoxButtons.YesNoCancel, MessageBoxType.Warning); if (result == DialogResult.Yes) { var saveFile = new Pablo.Actions.SaveFile(ViewHandler); saveFile.Execute(); } if (result == DialogResult.Cancel) { return(false); } } return(true); }
public DialogResult ShowDialog() { if (main.Document != null && (main.Document.IsModified || (main.EditMode && string.IsNullOrEmpty(main.Document.FileName)))) { var result = MessageBox.Show(main, "Do you wish to save?", "There are changes to this document", MessageBoxButtons.YesNoCancel); if (result == DialogResult.Yes || result == DialogResult.No) { if (result == DialogResult.Yes) { var action = new Pablo.Actions.SaveFile(main.ViewHandler); action.Execute(); } return(DialogResult.Ok); } else { return(DialogResult.Cancel); } } return(DialogResult.Ok); }