O'Reilly logo

C# 2008 and 2005 Threaded Programming: Beginner's Guide by Gastón C. Hillar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - Invoking a UI update from a task

You want to impress the NASA scientists with the speed of your nebula finder. Now that the parallel loop does not block the UI thread, you can use everything you know about delegates to provide precise UI feedback. Hence, you can amaze the scientists with the speed of your nebula finder queuing the UI thread with messages to show the images as they are being processed, instead of using a BackgroundWorker with sleeps.

Now, we are going to make the necessary changes to the application to allow it to invoke a user interface update from the asynchronous task when it completes processing each image in the parallel loop:

  1. Stay in the project, BlobCounter.
  2. Open the code for the Windows Form Form1 (frmNebulaFinder ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required