private bool _CloseEditor(IEditorUserInterface editor)
{
if (editor.IsModified) {
//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
var messageBox = new MessageBoxForm("Save changes to the sequence?", "Save Changes?", true, true);
messageBox.ShowDialog();
if (messageBox.DialogResult == DialogResult.Cancel)
return false;
if (messageBox.DialogResult == DialogResult.OK)
editor.Save();
}
else if (editor.IsEditorStateModified)
{
editor.Save();
}
if (_openEditors.Contains(editor)) {
_openEditors.Remove(editor);
}
_activeEditor= null;
AddSequenceToRecentList(editor.Sequence.FilePath);
editor.Activated-= editorUI_Activated;
editor.Closing -= editorUI_Closing;
//editor.Dispose();
//editor = null;
return true;
}