Updating <Tutorials.ThreadFunc>

The change to <ThreadFunc> will allow us to read the configuration file, create FileWorkerOption instances, create FileWorker instances, and then start the worker threads.

Before we read the configuration file, which is in XML, we want to add the import shown in Example 4-26 to the top of the Tutorial.vb, allowing us to directly instantiate the classes in the namespace.

Example 4-26. Adding the Xml namespace import.

Imports System.Xml

With the Xml namespace import in Example 4-26 added we can make the code changes required to utilize the new configuration file and updated <ThreadFunc> method listed in Example 4-27.

Example 4-27. Using the new <ThreadFunc> method.

Private Sub ThreadFunc() Try 'Load our Configuration File ...

Get Programming Windows® Services with Microsoft® Visual Basic® 2008 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.