public void GenerateReports(Measurement m) { if (m.Detector.ListMode) // generate list mode report if it is list mode, hey! { RawAnalysisReport rep = new RawAnalysisReport(ctrllog); rep.GenerateReport(m); ResultsReport = rep.replines; } MethodResultsReport mrep = new MethodResultsReport(ctrllog); mrep.ApplyReportSectionSelections(m.AcquireState.review.Selections); mrep.GenerateReport(m); foreach (List<string> r in mrep.INCCResultsReports) { INCCResultsReports.Add(r); } if (NC.App.AppContext.CreateINCC5TestDataFile) { TestDataFile mdat = new TestDataFile(ctrllog); mdat.GenerateReport(m); foreach (List<string> r in mdat.INCCTestDataFiles) { TestDataFiles.Add(r); } } if (NC.App.AppContext.OpenResults) { PrepNotepad(); if (bNotepadHappensToBeThere) { foreach (ResultFile fname in m.ResultsFiles) System.Diagnostics.Process.Start(notepadPath, fname.Path); } // optional enablement if (ExcelPush.ExcelPresent() && !string.IsNullOrEmpty(m.ResultsFiles.CSVResultsFileName.Path)) { #if EXCEL Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel.Workbook wb = excel.Workbooks.Open(m.ResultsFiles.CSVResultsFileName.Path); excel.Visible = true; #endif } } }
// NEXT: consider a pop-out report dialog with tabs for each report rather than the concatenated list 4 hrs void ReportPreview() { RawAnalysisReport rrep = new RawAnalysisReport(N.App.Loggers.Logger(LMLoggers.AppSection.Control)); rrep.GenerateInitialReportContent(N.App.Opstate.Measurement); Array sv = Enum.GetValues(typeof(MethodResultsReport.INCCReportSection)); bool[] SectionChoices = new bool[sv.Length]; SectionChoices[(int)MethodResultsReport.INCCReportSection.Header] = true; SectionChoices[(int)MethodResultsReport.INCCReportSection.Adjustments] = true; SectionChoices[(int)MethodResultsReport.INCCReportSection.Context] = true; SectionChoices[(int)MethodResultsReport.INCCReportSection.ShiftRegister] = true; SectionChoices[(int)MethodResultsReport.INCCReportSection.Isotopics] = true; MethodResultsReport mrep = new MethodResultsReport(N.App.Loggers.Logger(LMLoggers.AppSection.Control)); mrep.ApplyReportSectionSelections(SectionChoices); mrep.GenerateInitialReportContent(N.App.Opstate.Measurement); ReportView.Items.Clear(); int rep = 1; foreach (List<string> r in mrep.INCCResultsReports) { if (mrep.INCCResultsReports.Count > 0) ReportView.Items.Add(new ListViewItem(new string[] { "############ INCC Report " + rep.ToString() })); foreach (string s in r) { ReportView.Items.Add(new ListViewItem(new string[] { s })); } rep++; } if (rep > 1) // add blank line for readability ReportView.Items.Add(new ListViewItem(new string[] { "" })); ReportView.Items.Add(new ListViewItem(new string[] { "############ List Mode CSV Report" })); foreach (string s in rrep.replines) { ReportView.Items.Add(new ListViewItem(new string[] { s })); } }