Game Development Reference
In-Depth Information
if (worker.CancellationPending)
{
e.Cancel = true;
}
else
{
if (computeNumber < 2)
{
result = 1;
}
else
{
result = ComputeFibonacci(computeNumber - 1, worker, e) +
ComputeFibonacci(computeNumber - 2, worker, e);
}
int percentComplete = (int)((float)computeNumber /
(float)((int)e.Argument) * 100);
if (percentComplete > percentageReached)
{
percentageReached = percentComplete;
worker.ReportProgress(percentComplete);
}
}
return result;
}
Note
The DoWork method can complete in three ways: the process completes successfully, the user
requests cancellation, or an unhandled exception occurs.
Reporting Operation Progress
The ProgressChanged is used to report status to the user interface. This event is fired
whenever the ReportProgress method is invoked.
 
Search Nedrilad ::




Custom Search