runBackgroundWorker() public method

Runs the worker if no other worker instance is already running.
public runBackgroundWorker ( bool saveresult ) : void
saveresult bool
return void
Example #1
0
        private void recalculatebutton_Click(object sender, EventArgs e)
        {
            if (calculating)
            { //This means the button has been pressed to stop the computation.
                progressBar.Visible    = false;
                progressBar.Value      = 0;
                recalculatebutton.Text = "Calculate";
                calcLabel.Text         = "Analysis terminated.";
                calculating            = false;

                manager.stopComputation();
            }
            else
            { //This means the button has been pressed to re-calculate everything.
                calcLabel.Text         = "Calculating results.";
                progressBar.Visible    = true;
                calcLabel.Visible      = true;
                totalwords.Visible     = false;
                uniquewords.Visible    = false;
                resultsbox.Visible     = false;
                recalculatebutton.Text = "Terminate Calculation";
                manager.runBackgroundWorker(false);
            }
        }
 /// <summary>
 /// Calculate the word frequencies and display them in the pane.
 /// </summary>
 /// <param name="sender">Unused</param>
 /// <param name="e">Unused</param>
 private void freq_analyzer_Click(object sender, RibbonControlEventArgs e)
 {
     workermanager.createTaskPane();
     workermanager.runBackgroundWorker(false);
 }