Adding a FileWorker Class

The threads need access to the parameters and properties of file locations and file types. To simplify this process, we’ll create a class that we’ll use to create an instance of the worker thread. This class will contain all the functionality and properties we need, and we won’t have to add all the direct functionality to the service. You will also be able to reuse this functionality in other applications that you design.

Designing a New Class File

Add a new class file to the Tutorials project and call it FileWorker. Then add the following imports to the top of the class definition, as shown in Example 4-10.

Example 4-10. Add the file require imports.

Imports System.Resources Imports System.IO Imports System.Text Imports ...

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.