private bool ConfirmModelSaved() { bool cont = true; if (_model != null && _model.IsModified) { string text = "The current model has some unsaved changes." + Environment.NewLine + Environment.NewLine + "Do you wish to save the model before continuing ?"; DialogResult dr = MessageBox.Show(text, "Unsaved changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (dr.Equals(DialogResult.Yes)) { ICommand cmd = new CommandSave(_model); cmd.Execute(null); } else if (dr.Equals(DialogResult.Cancel)) { cont = false; } // else No - cont true; } return(cont); }
private void MainView_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (_model != null && _model.IsModified) { string text = "The current model has some unsaved changes." + Environment.NewLine + Environment.NewLine + "Do you wish to save your changes now ? " + Environment.NewLine + Environment.NewLine + "They will be lost if you click No"; DialogResult dr = MessageBox.Show(text, "DSM - Saved changes ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr.Equals(DialogResult.Yes)) { ICommand cmd = new CommandSave(_model); cmd.Execute(null); } } }
private void DoProjectSave() { ICommand cmd = new CommandSave(_model); CursorStateHelper csh = new CursorStateHelper(this, Cursors.WaitCursor); Refresh(); try { cmd.Execute(null); } catch (Exception ex) { ErrorDialog.Show(ex.ToString()); } finally { csh.Reset(); } }
public void Save() { var cmd = new CommandSave(); cmd.Execute(); }