/// <summary> /// Loads the page in another window. /// </summary> /// <param name="sender"></param> /// <param name="webForm"></param> private void Report_HtmlResponseViewEvent(object sender, HtmlPrintForm webForm) { this.AddDocument(webForm,"Print Report - HTML Response View",true); }
private void web_NewWindow2(object sender, AxSHDocVw.DWebBrowserEvents2_NewWindow2Event e) { // Create browser HtmlPrintForm htmlForm = new HtmlPrintForm(true); htmlForm.web.RegisterAsBrowser = false; e.ppDisp = htmlForm.web.Application; htmlForm.web.Visible = true; this.HtmlResponseViewEvent(this, htmlForm); }
/// <summary> /// Loads the xml report viewer. /// </summary> private void LoadXmlReportViewer() { printForm = new HtmlPrintForm(); printForm.PluginMenus = this.mnFile; printForm.ApplyToolbarSettingsEvent += new ApplyToolbarSettingsEventHandler(Report_ApplyToolbarSettingsEvent); printForm.ApplyMenuSettingsEvent += new ApplyMenuSettingsEventHandler(Report_ApplyMenuSettingsEvent); try { // merge reports //StringBuilder sb=new StringBuilder(); HtmlUnitTestReport report = new HtmlUnitTestReport(); for (int i=0;i<this.CurrentReportList.Count;i++) { report.Merge((HtmlUnitTestReport)this.CurrentReportList[i]); } printForm.LoadData(report.GetXml(),"xml"); AddDocument(printForm,"Report Preview - XML",true); } catch (Exception ex) { MessageBox.Show(ex.Message,AppLocation.ApplicationName,MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Loads the html report viewer. /// </summary> /// <param name="reportType"> The report type.</param> private void LoadHtmlReportViewer(string reportType) { ReportCommand reportCmd = new ReportCommand(); printForm = new HtmlPrintForm(); printForm.PluginMenus = this.mnFile; printForm.HtmlResponseViewEvent += new HtmlResponseViewEventHandler(Report_HtmlResponseViewEvent); printForm.ApplyToolbarSettingsEvent += new ApplyToolbarSettingsEventHandler(Report_ApplyToolbarSettingsEvent); printForm.ApplyMenuSettingsEvent += new ApplyMenuSettingsEventHandler(Report_ApplyMenuSettingsEvent); try { string logo = "<div class='ReportName'><img src='../gb logo.gif' align='middle'></img>Ecyware GreenBlue Inspector Report</div><br /><br /><br />"; // merge reports StringBuilder sb = new StringBuilder(); sb.Append("<html>"); sb.Append("<head><link rel='stylesheet' type='text/css' href='../report.css'></head>"); sb.Append("<body topmargin='40' leftmargin='10'>"); sb.Append(logo); ArrayList htmlFiles = new ArrayList(); for (int i=0;i<this.CurrentReportList.Count;i++) { HtmlUnitTestReport report = (HtmlUnitTestReport)this.CurrentReportList[i]; string html = string.Empty; if ( reportType == "basic" ) { html = reportCmd.CreateHtmlReport(report, InspectorConfig.BasicReportTemplate, InspectorConfig.SolutionDataFile, InspectorConfig.ReferenceDataFile); } else { html = reportCmd.CreateHtmlReport(report, InspectorConfig.AdvancedReportTemplate, InspectorConfig.SolutionDataFile, InspectorConfig.ReferenceDataFile); } sb.Append(html); // Add Html Response Content to array if ( report.ResponseDocument[0].IsHtmlResponseFile ) { htmlFiles.Add(System.Windows.Forms.Application.UserAppDataPath + "\\temphtml\\" + report.ResponseDocument[0].HtmlResponse); } } sb.Append("</body>"); sb.Append("</html>"); printForm.UpdateSavePrintReportMenu(true); printForm.HtmlContentResults = (string[])htmlFiles.ToArray(typeof(string)); printForm.LoadData(sb.ToString(), "html"); AddDocument(printForm, "Report Preview - HTML", true); } catch (Exception ex) { printForm.UpdateSavePrintReportMenu(false); MessageBox.Show(ex.Message,AppLocation.ApplicationName,MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Load html report from file. /// </summary> /// <param name="reportFilePath"> The html file report.</param> /// <param name="htmlReponseContentFiles"> The html response content files.</param> private void LoadHtmlReportFromFile(string reportFilePath,string[] htmlReponseContentFiles) { printForm = new HtmlPrintForm(); printForm.PluginMenus = this.mnFile; printForm.HtmlResponseViewEvent += new HtmlResponseViewEventHandler(Report_HtmlResponseViewEvent); printForm.ApplyToolbarSettingsEvent += new ApplyToolbarSettingsEventHandler(Report_ApplyToolbarSettingsEvent); printForm.ApplyMenuSettingsEvent += new ApplyMenuSettingsEventHandler(Report_ApplyMenuSettingsEvent); try { StreamReader reader = new StreamReader(reportFilePath, Encoding.UTF8); string data = reader.ReadToEnd(); reader.Close(); printForm.UpdateSavePrintReportMenu(true); printForm.HtmlContentResults = htmlReponseContentFiles; printForm.LoadData(data, "html"); AddDocument(printForm, "Report Preview - HTML", true); } catch (Exception ex) { printForm.UpdateSavePrintReportMenu(false); MessageBox.Show(ex.Message,AppLocation.ApplicationName,MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void HtmlBrowserInvoker(object sender, EventArgs e) { HtmlTextResultEventArgs args = (HtmlTextResultEventArgs)e; printForm = new HtmlPrintForm(); printForm.PluginMenus = this.mnFile; printForm.HtmlResponseViewEvent += new HtmlResponseViewEventHandler(Report_HtmlResponseViewEvent); printForm.ApplyToolbarSettingsEvent += new ApplyToolbarSettingsEventHandler(Report_ApplyToolbarSettingsEvent); printForm.ApplyMenuSettingsEvent += new ApplyMenuSettingsEventHandler(Report_ApplyMenuSettingsEvent); try { if ( args.Append ) { printForm.AppendData(args.HtmlText, false); } else { printForm.AppendData(args.HtmlText, true); } printForm.UpdateSavePrintReportMenu(true); AddDocument(printForm, "Display Results", true); } catch (Exception ex) { printForm.UpdateSavePrintReportMenu(false); MessageBox.Show(ex.Message,AppLocation.ApplicationName,MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Raised when a document is changed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dmDocuments_FocusedDocumentChanged(object sender, System.EventArgs e) { BasePluginForm plugin = (BasePluginForm)dmDocuments.FocusedDocument.Control; if ( plugin is ScriptingDataDesigner ) { // Hide dhRightPanel.Hide(); dhBottomPanel.Hide(); _scriptingDataDesigner = (ScriptingDataDesigner)plugin; } if ( plugin is NavigableWebForm ) { dhRightPanel.Show(); dhBottomPanel.Show(); navForm = (NavigableWebForm)plugin; } if ( plugin is HtmlPrintForm ) { printForm = (HtmlPrintForm)plugin; } }