private void Export(ReportFormat reportFormat, ReportType reportType, SaveFileDialog dialog) { dialog.FileName = String.Format("Database Benchmark {0:yyyy-MM-dd HH.mm}", DateTime.Now); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { try { // Start loading and disable MainForm. LoadingForm.Start(string.Format("Exporting to {0} ....", reportFormat), Bounds); Enabled = false; switch (reportFormat) { case ReportFormat.CSV: CsvUtils.ExportResults(History, saveFileDialogCsv.FileName, reportType); break; case ReportFormat.JSON: ComputerConfiguration configuration = SystemUtils.GetComputerConfiguration(); JsonUtils.ExportToJson(saveFileDialogJson.FileName, configuration, History, reportType); break; case ReportFormat.PDF: BenchmarkTest test = History[0]; PdfUtils.Export(saveFileDialogPdf.FileName, ApplicationManager.StepFrames, test.FlowCount, test.RecordCount, test.Randomness, SystemUtils.GetComputerConfiguration(), reportType); break; } // Stop loading end enable MainForm LoadingForm.Stop(); Enabled = true; } catch (Exception exc) { string message = string.Format("Export results to {0} failed...", reportFormat); Logger.Error(message, exc); ReportError(message); Enabled = true; LoadingForm.Stop(); } } }