Exemplo n.º 1
0
        /// <summary>
        /// Creates a new editor window within this form and displays it.
        /// </summary>
        /// <param name="fileName">The filename of the file contained in this form.</param>
        /// <param name="codeData">The data in the file to show in the editor control.</param>
        /// <returns></returns>
        public CodeEditor AddEditorWindow(string fileName = null, string codeData = null)
        {
            CodeEditor editor = new CodeEditor(this);

            editor.MdiParent = this;
            if (fileName != null && codeData != null)
            {
                editor.LoadContents(fileName, codeData);
            }
            editor.Show();
            ActivateMdiChild(editor);
            return(editor);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Opens the specified file in an Editor window.
        /// </summary>
        /// <param name="fileName">The filename of the file to open.</param>
        /// <param name="editor">The editor to open the file in, or null to create a new one.</param>
        public void Open(string fileName, CodeEditor editor = null)
        {
            string codeData = File.ReadAllText(fileName);

            if (editor == null)
            {
                AddEditorWindow(fileName, codeData);
            }
            else
            {
                editor.LoadContents(fileName, codeData);
                editor.editorControl.ActiveTextAreaControl.Caret.Line   = 0;
                editor.editorControl.ActiveTextAreaControl.Caret.Column = 0;
                editor.UpdateWindowTitle();
                editor.Activate();
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a new editor window within this form and displays it.
 /// </summary>
 /// <param name="fileName">The filename of the file contained in this form.</param>
 /// <param name="codeData">The data in the file to show in the editor control.</param>
 /// <returns></returns>
 public CodeEditor AddEditorWindow(string fileName = null, string codeData = null)
 {
     CodeEditor editor = new CodeEditor(this);
     editor.MdiParent = this;
     if (fileName != null && codeData != null)
         editor.LoadContents(fileName, codeData);
     editor.Show();
     ActivateMdiChild(editor);
     return editor;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Opens the specified file in an Editor window.
 /// </summary>
 /// <param name="fileName">The filename of the file to open.</param>
 /// <param name="editor">The editor to open the file in, or null to create a new one.</param>
 public void Open(string fileName, CodeEditor editor = null)
 {
     string codeData = File.ReadAllText(fileName);
     if (editor == null)
     {
         AddEditorWindow(fileName, codeData);
     }
     else
     {
         editor.LoadContents(fileName, codeData);
         editor.editorControl.ActiveTextAreaControl.Caret.Line = 0;
         editor.editorControl.ActiveTextAreaControl.Caret.Column = 0;
         editor.UpdateWindowTitle();
         editor.Activate();
     }
 }