Reporting Progress

Reporting the progress of an asynchronous method execution is a common requirement. There is a pattern that you can use and that makes things easier. This pattern relies on the System.IProgress(Of T) interface and the System.Progress(Of T) class, which expose a ProgressChanged event that must be raised when the asynchronous operation is in progress. To provide an example that is easy to understand, imagine you still want to download the content of some feeds from the Microsoft Channel9 website and refresh the progress every time a site has been downloaded completely. The current example is based on a Console application. Consider the following code:

Private progress As Progress(Of Integer)Private ...

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.