private bool _CloseEditor(IEditorUserInterface editor)
        {
            if (editor.IsModified)
            {
                DialogResult result = MessageBox.Show("Save changes to the sequence?", "Save Changes?", MessageBoxButtons.YesNoCancel);
                if (result == System.Windows.Forms.DialogResult.Cancel)
                {
                    return(false);
                }

                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    editor.Save();
                }
            }

            if (_openEditors.Contains(editor))
            {
                _openEditors.Remove(editor);
                Form editorForm = editor as Form;
                editor.Dispose();
            }

            AddSequenceToRecentList(editor.Sequence.FilePath);

            return(true);
        }
Beispiel #2
0
        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();
                }
            }

            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);
        }
        private bool _CloseEditor(IEditorUserInterface editor)
        {
            if (editor.IsModified) {
                DialogResult result = MessageBox.Show("Save changes to the sequence?", "Save Changes?", MessageBoxButtons.YesNoCancel);
                if (result == System.Windows.Forms.DialogResult.Cancel)
                    return false;

                if (result == System.Windows.Forms.DialogResult.Yes)
                    editor.Save();
            }

            if (_openEditors.Contains(editor))
            {
                _openEditors.Remove(editor);
                Form editorForm = editor as Form;
                editor.Dispose();
            }

            AddSequenceToRecentList(editor.Sequence.FilePath);

            return true;
        }
Beispiel #4
0
        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();
            }

            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;
        }