Exemple #1
0
        private void LoadFromFile(string path)
        {
            LoadingForm.Start("Loading project...", Bounds);

            ApplicationManager.Load(path);
            Text = String.Format("{0} - Database Benchmark", Path.GetFileName(path));
            saveConfigurationToolStripMenuItem.Enabled = true;

            LoadingForm.Stop();
        }
Exemple #2
0
        private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (saveFileDialogProject.ShowDialog() == DialogResult.OK)
            {
                LoadingForm.Start("Saving project...", Bounds);
                ApplicationManager.Store(saveFileDialogProject.FileName);
                LoadingForm.Stop();

                saveConfigurationToolStripMenuItem.Enabled = true;
                Text = String.Format("{0} - DatabaseBenchmark", Path.GetFileName(saveFileDialogProject.FileName));
            }
        }
Exemple #3
0
        private void StartOnlineReport()
        {
            try
            {
                LoadingForm.Start("Obtaining computer configuration...", Bounds);
                ReportForm form = new ReportForm(History);
                LoadingForm.Stop();

                form.ShowDialog();
            }
            catch (Exception exc)
            {
                LoadingForm.Stop();
                Logger.Error("Online report exception occured ...", exc);
            }
        }
Exemple #4
0
        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();
                }
            }
        }
Exemple #5
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Save current project ?", "Save project", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                if (saveConfigurationToolStripMenuItem.Enabled)
                {
                    saveConfigurationToolStripMenuItem_Click(sender, e);
                }
                else
                {
                    saveAsToolStripMenuItem_Click(sender, e);
                }
            }

            LoadingForm.Start("Creating project...", Bounds);

            ApplicationManager.Reset();
            saveConfigurationToolStripMenuItem.Enabled = false;
            Text = "Database Benchmark.dbproj - Database Benchmark";

            LoadingForm.Stop();
        }
Exemple #6
0
 private void saveConfigurationToolStripMenuItem_Click(object sender, EventArgs e)
 {
     LoadingForm.Start("Saving project...", Bounds);
     ApplicationManager.Store(saveFileDialogProject.FileName);
     LoadingForm.Stop();
 }