public void OpenFile(string fileName) { StreamReader sr = null; try { sr = new StreamReader(fileName, Encoding.ASCII); string code = sr.ReadToEnd(); OpenFileEventArgs e = new OpenFileEventArgs(fileName, code); OnOpenFile(e); } catch (IOException ex) { OnAppError(new AppErrorEventArgs(ex.Message)); } catch (OutOfMemoryException ex) { OnAppException(new AppExceptionEventArgs(ex)); } catch (Exception ex) { OnAppException(new AppExceptionEventArgs(ex)); } finally { if (sr != null) sr.Close(); } }
protected void OnOpenFile(OpenFileEventArgs e) { if (OnOpenFileHandler != null) OnOpenFileHandler(this, e); }
private void App_OnOpenFile(object sender, OpenFileEventArgs e) { TreeNode node = null; try { if (this.tcFiles.Controls.ContainsKey(e.FileName)) { this.tcFiles.SelectTab(e.FileName); } else { _fileName = e.FileName; this.Text = Application.ProductName + ": " + e.Name; //txtFile.Text = e.Code; IDEMode = IDEModes.SingleFile; ClearAllFileTabs(); tvFiles.Nodes.Clear(); node = tvFiles.Nodes.Add(e.Name); node.Tag = new TestSuiteFileEntry(e.FileName, null, null, null, 0); ShowTabPage(node); } } catch (Exception ex) { DisplayException(ex); } }