private void newToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Save current project ?", "Save project", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (result == DialogResult.Cancel) { return; } if (result == DialogResult.Yes) { if (saveConfigurationToolStripMenuItem.Enabled) { saveConfigurationToolStripMenuItem_Click(sender, e); } else { saveAsToolStripMenuItem_Click(sender, e); } } LoadingFrame.Start("Creating project...", Bounds); MainLayout.Reset(); saveConfigurationToolStripMenuItem.Enabled = false; Text = "NewProject.dbproj - Database Benchmark"; LoadingFrame.Stop(); }
private void LoadFromFile(string path) { LoadingFrame.Start("Loading project...", Bounds); Manager.Load(path); Text = String.Format("{0} - Database Benchmark", Path.GetFileName(path)); saveConfigurationToolStripMenuItem.Enabled = true; LoadingFrame.Stop(); }
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) { if (saveFileDialogProject.ShowDialog() == DialogResult.OK) { LoadingFrame.Start("Saving project...", Bounds); Manager.Store(saveFileDialogProject.FileName); LoadingFrame.Stop(); saveConfigurationToolStripMenuItem.Enabled = true; Text = String.Format("{0} - Database Benchmark", Path.GetFileName(saveFileDialogProject.FileName)); } }
private void OnlineReport() { try { LoadingFrame.Start("Obtaining computer configuration...", Bounds); ReportForm form = new ReportForm(History); LoadingFrame.Stop(); form.ShowDialog(); } catch (Exception exc) { LoadingFrame.Stop(); Logger.Error("Online report exception occured ...", exc); } }
private void Export(ReportFormat reportFormat, ReportType reportType, SaveFileDialog dialog) { string postfix = reportType == ReportType.Detailed ? "detailed" : "summary"; dialog.FileName = String.Format("DatabaseBenchmark-{0:yyyy-MM-dd HH.mm}-{1}", DateTime.Now, postfix); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { try { // Start loading and disable MainForm. LoadingFrame.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: // TODO: Fix this. //BenchmarkSession test = History[0]; //PdfUtils.Export(saveFileDialogPdf.FileName, MainLayout.StepFrames, test.FlowCount, test.RecordCount, test.Randomness, SystemUtils.GetComputerConfiguration(), reportType); break; } // Stop loading end enable MainForm LoadingFrame.Stop(); Enabled = true; } catch (Exception exc) { string message = string.Format("Export results to {0} failed...", reportFormat); Logger.Error(message, exc); ReportError(message); Enabled = true; LoadingFrame.Stop(); } } }
private void saveConfigurationToolStripMenuItem_Click(object sender, EventArgs e) { LoadingFrame.Start("Saving project...", Bounds); Manager.Store(saveFileDialogProject.FileName); LoadingFrame.Stop(); }