private void WriteReportFilePB_Click(object sender, RoutedEventArgs e) { bool success = true; List <AnalysisContainer> analysisList = new List <AnalysisContainer>(); foreach (AnalysisListItem aItem in VM.AnalysisList) { if (aItem.Selected) { AnalysisContainer analCont; success = m_wgDB.GetAnalysis(aItem.AnalysisID, out analCont); if (success && analCont != null) { analysisList.Add(analCont); } } } switch (VM.ReportFormat) { case REPORT_FILEFORMAT.WAVEGUIDE: m_reportWriter.SetFileType(REPORT_FILEFORMAT.WAVEGUIDE); success = m_reportWriter.WriteExperimentFile_WaveGuide(VM.Directory + "\\" + VM.Filename, analysisList); break; case REPORT_FILEFORMAT.EXCEL: m_reportWriter.SetFileType(REPORT_FILEFORMAT.EXCEL); int i = 1; foreach (AnalysisContainer analysis in analysisList) { string[] strs = VM.Filename.Split('.'); string filename = strs[0] + "_" + i.ToString() + "." + strs[1]; success = m_reportWriter.WriteExperimentFile_Excel(VM.Directory + "\\" + filename, analysis); if (!success) { break; } i++; } break; } if (success) { Close(); } else { MessageBoxResult result = System.Windows.MessageBox.Show("Failed to write report: " + m_reportWriter.GetLastErrorString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void SetAnalysisList() { VM.AnalysisList.Clear(); foreach (ExperimentIndicatorContainer expIndicator in m_expIndicatorList) { bool success = m_wgDB.GetAllAnalysesForExperimentIndicator(expIndicator.ExperimentIndicatorID); foreach (AnalysisContainer analCont in m_wgDB.m_analysisList) { AnalysisContainer ac; success = m_wgDB.GetAnalysis(analCont.AnalysisID, out ac); if (success && ac != null) { if (ac.RuntimeAnalysis) { ac.Description = expIndicator.Description; VM.AnalysisList.Add(ac); } } } } }