/// <summary>
/// Handle update event from the evolution algorithm - update the view.
/// </summary>
public void _ea_UpdateEvent(object sender, EventArgs e)
{
// Switch execution to GUI thread if necessary.
if (this.InvokeRequired)
{
// Must use Invoke(). BeginInvoke() will execute asynchronously and the evolution algorithm therefore
// may have moved on and will be in an intermediate and indeterminate (between generations) state.
this.Invoke(new MethodInvoker(delegate()
{
if (this.IsDisposed)
{
return;
}
// Update plot points for each series in turn.
int sourceCount = _dataSourceArray.Length;
for (int i = 0; i < sourceCount; i++)
{
SummaryDataSource ds = _dataSourceArray[i];
Point2DDouble[] pointArr = ds.GetPointArray();
PointPairList ppl = _pointPlotArray[i];
EnsurePointPairListLength(ppl, pointArr.Length);
for (int j = 0; j < pointArr.Length; j++)
{
ppl[j].X = pointArr[j].X;
ppl[j].Y = pointArr[j].Y;
}
}
// Trigger graph to redraw.
zed.AxisChange();
Refresh();
}));
}
}