How do I report change of the CountValue from this class to a backgroundworker
class SomeOtherClass
{
public void CountUp()
{
int CountValue;
for (int i = 0; i < 100000000; i++)
CountValue = i;
}
}
Here is the implemetation of the DoWork function
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
BackgroundWorker worker = sender as BackgroundWorker;
SomeOtherClass MyOtherClass = new SomeOtherClass();
int CountValue;
if ((worker.CancellationPending == true))
{
e.Cancel = true;
}
else
{
MyOtherClass.CountUp();
worker.ReportProgress(CountValue);
}
}