/// <summary> /// Set active document. /// </summary> /// <param name="editorForm">Returns instance of the <see cref="Editor"/> class which need to be set as an active document.</param> public static void SetActiveDocument(Editor editorForm) { if (editorList.ContainsValue(editorForm) == true) // Set active document if the editor exist in list. { ActiveDocument = editorForm; } }
/// <summary> /// Open a file. /// </summary> /// <param name="filePath">Path of the file which need to be opened.</param> /// <param name="isInProject">If this is <c>true</c> it will mark file as a project file.</param> /// <returns>Returns an instance object of the <see cref="Editor"/> class or null if the file already exist.</returns> public static Editor Open(string filePath, bool isInProject) { if (editorList.ContainsKey(filePath) == true) // Is file already opened? Yes, let's stop execution. { return null; } Editor editor = new Editor(); editor.Open(filePath); editor.IsProjectFile = isInProject; editorList.Add(filePath, editor); editor.Show(dockPanel, DockState.Document); return editor; }