private bool IsSavedOrOverwriteUnsaved() { if (AllStarsRomFile is null || !AllStarsRomFile.HasUnsavedChanges) { return(true); } var dialogResult = MessageBox.Show( this, "Brutario", "You have unsaved changes. Do you wish to save them before opening a new file?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); switch (dialogResult) { case DialogResult.Yes: AllStarsRomFile.Save(); return(true); case DialogResult.No: return(true); case DialogResult.Cancel: default: return(false); } }
public void Open() { if (!IsSavedOrOverwriteUnsaved()) { return; } if (openFileDialog.ShowDialog(this) == DialogResult.OK) { AllStarsRomFile = new AllStarsRomFile(openFileDialog.FileName); } }