public void RescanExampleParallelAsync(bool colorChanged) { tasks.Clear(); foreach (BasePlotter p in examplePlottersGeneral) { p.SmoozeType = smoozeType; if (colorChanged) { p.Map.CalculatedTypes.Clear(); } tasks.Add(Task.Run(() => p.DoCalculation())); } foreach (BasePlotter p in examplePlottersJulia) { p.SmoozeType = smoozeType; if (colorChanged) { p.Map.CalculatedTypes.Clear(); } tasks.Add(Task.Run(() => p.DoCalculation())); } foreach (BasePlotter p in examplePlottersMira) { p.SmoozeType = smoozeType; if (colorChanged) { p.Map.CalculatedTypes.Clear(); } tasks.Add(Task.Run(() => p.DoCalculation())); } foreach (MiraLinePlotter m in miraLineplotExamples) { tasks.Add(Task.Run(() => m.setFavorite(m.ExampleNumber))); } var results = Task.WhenAll(tasks); for (int i = 0; i < examplePlottersGeneral.Count; i++) { PlotForm.AddExampleImage(i, examplePlottersGeneral[i].map.Bitmap, examplePlottersGeneral[i].Title, ExampleGroups.General); } for (int i = 0; i < examplePlottersJulia.Count; i++) { PlotForm.AddExampleImage(i, examplePlottersJulia[i].map.Bitmap, examplePlottersJulia[i].Title, ExampleGroups.Julia); } for (int i = 0; i < examplePlottersMira.Count; i++) { PlotForm.AddExampleImage(i, examplePlottersMira[i].map.Bitmap, examplePlottersMira[i].Title, ExampleGroups.Line); } foreach (MiraLinePlotter miraLineplot in miraLineplotExamples) { PlotForm.AddExampleImage(miraLineplot.ExampleNumber, miraLineplot.map.Bitmap, miraLineplot.StartPoint.X.ToString("00.0") + " - " + miraLineplot.StartPoint.Y.ToString("00.0") + Environment.NewLine + miraLineplot.Parameters[0].ToString("0.00") + " - " + miraLineplot.Parameters[6].ToString("0.00"), ExampleGroups.MiraLine); } PlotForm.RescanExamples(); }