I have a class Population that contains A method Evolve wich iterate until int variable generationsNumber < population.Size. I want to avoid the main window to tell "NotResponding" and to update a progressbar. I want to use BackgroundWorker class. The problem is that I don't know how to notify the ProgressChanged that value of generationsNumber has changed. Thank you! Pracicaly:
/////////////
MainWindow.cs
/////////////
void m_oWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
Population p=new Population()
...
p.Evolve();
//Where to call ReportProgress? I cannot acces local variable generationsNumber that is declared in Evolve method
}