Example #1
0
 private bool DoSave(SciTextEditorControl editor)
 {
     if (string.IsNullOrEmpty(editor.FileName))
     {
         return(DoSaveAs(editor));
     }
     else
     {
         try
         {
             editor.SaveFile(editor.FileName);
             SetModifiedFlag(editor, false);
             return(true);
         }
         catch (Exception ex)
         {
             MessageBox.Show(this, ex.Message, ex.GetType().Name);
             return(false);
         }
     }
 }
Example #2
0
        private bool DoSaveAs(SciTextEditorControl editor)
        {
            saveFileDialog.FileName = editor.FileName;
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    editor.SaveFile(saveFileDialog.FileName);
                    editor.Parent.Text = Path.GetFileName(editor.FileName);
                    SetModifiedFlag(editor, false);

                    // The syntax highlighting strategy doesn't change
                    // automatically, so do it manually.
                    //editor.Document.HighlightingStrategy =
                    //    HighlightingStrategyFactory.CreateHighlightingStrategyForFile(editor.FileName);
                    return(true);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, ex.Message, ex.GetType().Name);
                }
            }
            return(false);
        }
Example #3
0
        private bool DoSaveAs(SciTextEditorControl editor)
        {
            saveFileDialog.FileName = editor.FileName;
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    editor.SaveFile(saveFileDialog.FileName);
                    editor.Parent.Text = Path.GetFileName(editor.FileName);
                    SetModifiedFlag(editor, false);

                    // The syntax highlighting strategy doesn't change
                    // automatically, so do it manually.
                    //editor.Document.HighlightingStrategy = 
                    //    HighlightingStrategyFactory.CreateHighlightingStrategyForFile(editor.FileName);
                    return true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, ex.Message, ex.GetType().Name);
                }
            }
            return false;
        }
Example #4
0
 private bool DoSave(SciTextEditorControl editor)
 {
     if (string.IsNullOrEmpty(editor.FileName))
         return DoSaveAs(editor);
     else
     {
         try
         {
             editor.SaveFile(editor.FileName);
             SetModifiedFlag(editor, false);
             return true;
         }
         catch (Exception ex)
         {
             MessageBox.Show(this, ex.Message, ex.GetType().Name);
             return false;
         }
     }
 }