private void CalcApertures() { CalcAperturesSkyBkgndBrightness = SkyBkgndBrightness; var view = new GenLib.Progress.Manual.View(); new Thread(() => view.ShowDialog()) { Name = "CalcApertures" }.Start(); view.SetParms("Calculate Progress", "Calculating minimum apertures and best exit pupils to detect objects"); var progState = new ProgressState { Total = GridViewObjects.DataSource.CastSafe <List <DisplayRecord> >().Count, Current = 0, Interval = 100, }; GridViewObjects.DataSource.CastSafe <List <DisplayRecord> >() .ForEach(displayRecord => { CalcAnAperture(displayRecord); progState.IncrementAndReport(view.UpdateProgress); }); view.InvokeExt(v => v.Close()); GridViewObjects.RefreshData(); }