public void loadSourceCodeFileIntoTextEditor(String fileToLoad, TextEditorControlBase tecTargetTextEditor) { fileToLoad = tryToResolveFileLocation(fileToLoad, this); //this.okThreadSync(delegate //ExtensionMethods.invokeOnThread((Control)this, () => tecSourceCode.invokeOnThread( () => { try { partialFileViewMode = false; lbPartialFileView.Visible = false; tecSourceCode.Visible = true; long iCurrentFileSize = Files_WinForms.getFileSize(fileToLoad); if (iCurrentFileSize > (iMaxFileSize*1024)) { PublicDI.log.error("File to load is too big: max is {0}k, this file is {1}k : {2}", iMaxFileSize, iCurrentFileSize/1024, fileToLoad); loadPartialFileView(fileToLoad); } else { if (fileToLoad.extension(".h2")) { setPathToFileLoaded(fileToLoad); setDocumentContents(H2.load(fileToLoad).SourceCode, fileToLoad, false); setDocumentHighlightingStrategy("aa.cs"); } else { tecTargetTextEditor.LoadFile(fileToLoad); } if (fileToLoad.extension(".o2")) { var realFileTypeToload = Path.GetFileNameWithoutExtension(fileToLoad); tecSourceCode.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategyForFile(realFileTypeToload); } lbSourceCode_UnsavedChanges.Visible = false; btSaveFile.Enabled = false; eFileOpen(fileToLoad); } } catch (Exception ex) { PublicDI.log.error("in loadSourceCodeFileIntoTextEditor: {0}", ex.Message); } return default(object); }); }