예제 #1
0
        /// <summary>
        /// Runs the test and shows the progress window.
        /// </summary>
        /// <param name="config">The testing configuration to use.</param>
        public void Run()
        {
            // Ensure the menu operations cease when tests are running
            ProfilerMenu.testActive = true;

            // Initialize progress bar
            progressBarTests.Maximum = 100;
            progressBarTests.Minimum = 0;
            progressBarTests.Value   = 0;

            // Initialize percentage label
            percLabel.Text = "0";

            // Initialize background worker
            worker = new TestWorker(config);
            worker.ProgressChanged += new ProgressChangedEventHandler(workerReport);
            worker.OnComplete      += new TestCompletedEventHandler(workerComplete);

            // Initialize percentage on last update
            percOnlastUpdate = 0;

            // Initialize config display
            configTextBox.Text += "Algorithm: " + config.Algorithm.ToString() + "\n";
            configTextBox.Text += "Map: " + config.MapName + "\n";
            configTextBox.Text += "Path Distance: " + config.PathDistance + "\n";
            configTextBox.Text += "Running " + config.NumberOfTestRuns + " tests.\n";
            configTextBox.Text += "Outputting results to " + config.OutputFile + ".txt\n";

            // Initialize timing calculations
            currentTimeEstimate = TimeSpan.Zero;
            currentIterations   = 0;

            // Run background worker thread
            worker.RunWorkerAsync();
        }
예제 #2
0
        /// <summary>
        /// Runs the test and shows the progress window.
        /// </summary>
        /// <param name="config">The testing configuration to use.</param>
        public void Run()
        {
            // Ensure the menu operations cease when tests are running
            ProfilerMenu.testActive = true;

            // Initialize progress bar
            progressBarTests.Maximum = 100;
            progressBarTests.Minimum = 0;
            progressBarTests.Value = 0;

            // Initialize percentage label
            percLabel.Text = "0";

            // Initialize background worker
            worker = new TestWorker(config);
            worker.ProgressChanged += new ProgressChangedEventHandler(workerReport);
            worker.OnComplete += new TestCompletedEventHandler(workerComplete);

            // Initialize percentage on last update
            percOnlastUpdate = 0;

            // Initialize config display
            configTextBox.Text += "Algorithm: " + config.Algorithm.ToString() + "\n";
            configTextBox.Text += "Map: " + config.MapName + "\n";
            configTextBox.Text += "Path Distance: " + config.PathDistance + "\n";
            configTextBox.Text += "Running " + config.NumberOfTestRuns + " tests.\n";
            configTextBox.Text += "Outputting results to " + config.OutputFile + ".txt\n";

            // Initialize timing calculations
            currentTimeEstimate = TimeSpan.Zero;
            currentIterations = 0;

            // Run background worker thread
            worker.RunWorkerAsync();
        }
예제 #3
0
        /// <summary>
        /// Event handler. Used to update the form when the worker reports progress.
        /// </summary>
        private void workerReport(object sender, ProgressChangedEventArgs args)
        {
            TestWorker wrkr = sender as TestWorker;

            percLabel.Text = Convert.ToString(Convert.ToInt32(percLabel.Text) + args.ProgressPercentage);
            progressBarTests.Increment(args.ProgressPercentage);
            this.Refresh();
        }
예제 #4
0
        /// <summary>
        /// Event handler. Used to update the form when the worker reports progress.
        /// </summary>
        private void workerReport(object sender, ProgressChangedEventArgs args)
        {
            TestWorker   wrkr     = sender as TestWorker;
            TestProgress progress = (TestProgress)args.UserState;

            EstimateTimeRemaining(progress);

            percLabel.Text = Convert.ToString(args.ProgressPercentage) + "%" + " (" + progress.TestsComplete + "/" + progress.TestsToDo + ")";
            progressBarTests.Increment(args.ProgressPercentage - percOnlastUpdate);
            percOnlastUpdate = args.ProgressPercentage;
            this.Refresh();
        }
예제 #5
0
        /// <summary>
        /// Runs the test and shows the progress window.
        /// </summary>
        /// <param name="config">The testing configuration to use.</param>
        public void Run(TestConfig config)
        {
            // Show as a dialog
            this.Show();

            // Initialize progress bar
            progressBarTests.Maximum = 100;
            progressBarTests.Minimum = 0;
            progressBarTests.Value   = 0;

            // Initialize percentage label
            percLabel.Text = "0";

            // Initialize background worker
            worker = new TestWorker(config);
            worker.ProgressChanged += new ProgressChangedEventHandler(workerReport);
            worker.OnComplete      += new TestCompletedEventHandler(workerComplete);

            // Run background worker thread
            worker.RunWorkerAsync();
        }
예제 #6
0
        /// <summary>
        /// Runs the test and shows the progress window.
        /// </summary>
        /// <param name="config">The testing configuration to use.</param>
        public void Run(TestConfig config)
        {
            // Show as a dialog
            this.Show();

            // Initialize progress bar
            progressBarTests.Maximum = 100;
            progressBarTests.Minimum = 0;
            progressBarTests.Value = 0;

            // Initialize percentage label
            percLabel.Text = "0";

            // Initialize background worker
            worker = new TestWorker(config);
            worker.ProgressChanged += new ProgressChangedEventHandler(workerReport);
            worker.OnComplete += new TestCompletedEventHandler(workerComplete);

            // Run background worker thread
            worker.RunWorkerAsync();
        }
예제 #7
0
 private void buttonCancel_Click(object sender, EventArgs e)
 {
     TestWorker.Cancel();
 }