Example #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                if (MainTask != null)
                {
                    btnStop.Enabled = MainTask.Status == TaskStatus.Running ? true : false;
                }

                btnTreeView.Checked = MainLayout.TreeView.Visible;

                btnStart.Enabled = !btnStop.Enabled;

                MainLayout.TreeView.TreeViewEnabled = btnStart.Enabled;
                MainLayout.EnablePropertiesFrame(btnStart.Enabled);

                cbFlowsCount.Enabled  = btnStart.Enabled;
                cbRecordCount.Enabled = btnStart.Enabled;
                trackBar1.Enabled     = btnStart.Enabled;

                cloneToolStripMenuItem.Enabled             = btnStart.Enabled;
                renameToolStripMenuItem.Enabled            = btnStart.Enabled;
                deleteToolStripMenuItem.Enabled            = btnStart.Enabled;
                restoreDefaultAllToolStripMenuItem.Enabled = btnStart.Enabled;
                expandAllToolStripMenuItem.Enabled         = btnStart.Enabled;
                collapseAllToolStripMenuItem.Enabled       = btnStart.Enabled;

                bool isStoped = !(History.Count == 0 || MainTask.Status == TaskStatus.Running);

                btnExports.Enabled = isStoped;

                exportResultToPDFToolStripMenuItem.Enabled   = isStoped;
                exportToCSVToolStripMenuItem.Enabled         = isStoped;
                exportToJSONToolStripMenuItem.Enabled        = isStoped;
                onlineReportResultsToolStripMenuItem.Enabled = isStoped;

                legendPossitionToolStripMenuItem.Enabled = showLegendToolStripMenuItem.Checked;

                var activeFrame = MainLayout.GetCurrentFrame();
                var session     = Current;

                if (session == null)
                {
                    progressBar.Value       = 0;
                    progressStatus.Text     = "(None)";
                    percentStatus.Text      = "%";
                    elapsedTimeStatus.Text  = "Elapsed: ";
                    estimateTimeStatus.Text = "Estimate: ";
                    return;
                }

                // TODO: Fix this.
                //var method = session.CurrentMethod;
                //if (method == TestMethod.None)
                //    return;

                //if (autoNavigatetoolStripMenuItem.Checked)
                //    MainLayout.StepFrames[method].Activate();

                //TimeSpan elapsed = session.GetElapsedTime(method);

                //long currentRecords = session.GetRecords(method);
                //long totalRecords = TableCount * RecordCount;
                //double progress = (100.0 * currentRecords) / totalRecords;

                //var database = session.Database;

                //// Draw charts.
                //if (activeFrame.Text != null) // Frame is in write, read or other mode.
                //{
                //    int averagePossition = activeFrame.lineChartAverageSpeed.GetPointsCount(database.Name);
                //    int momentPossition = activeFrame.lineChartMomentSpeed.GetPointsCount(database.Name);

                //    var averageSpeedData = session.GetAverageSpeeds(method, averagePossition);
                //    var momentSpeedData = session.GetMomentSpeeds(method, momentPossition);
                //    var memoryData = session.GetMomentWorkingSets(method, averagePossition);

                //    activeFrame.AddAverageSpeed(database.Name, averageSpeedData);
                //    activeFrame.AddMomentSpeed(database.Name, momentSpeedData);
                //    activeFrame.AddPeakMemoryUsage(database.Name, memoryData);
                //}

                //if (Math.Abs(progress - 0.0) <= double.Epsilon)
                //    estimateTimeStatus.Text = "Estimate: infinity";
                //else
                //{
                //    TimeSpan timeSpan = new TimeSpan((long)((elapsed.Ticks * (100.0 - progress)) / progress));
                //    estimateTimeStatus.Text = String.Format("Estimate: {0:dd\\.hh\\:mm\\:ss}", timeSpan);
                //}

                //elapsedTimeStatus.Text = String.Format("Elapsed: {0:dd\\.hh\\:mm\\:ss} ", elapsed);
                //progressBar.Value = (int)progress;
                //percentStatus.Text = string.Format("{0:f2}%", progress);
                //progressStatus.Text = database.Name + " " + CurrentStatus;
            }
            catch (Exception exc)
            {
                Logger.Error("Application exception occured...", exc);
            }
        }