HV-Lima Peru

Offshore your .NET/SQL Development to Latin America! Languages: en-de-es

Multithreading with asynchronous Delegates and Backgroundworker

Why that?
Programming true Multithreading is a hard job.
Yet using Multithreading to just create responsive UIs is a lot easier.
The biggest problem for later reuse of any code is always programming UI-code with intermingled business logic.
This HV.Pattern creates the possibility to encapsulate business logic in a backgroundworker that is called from within an own independent class.
The big hit is (see following illustration), that B (here in the HV.Tools-Assembly) encapsulates an asynchronous C.
During runtime the C will run on its own thread, making A’s UI absolutely responsive.
This is no pseudo-background working as with the use of a timer-control or with calls to me.update or Application.DoEvents.
This is true preemptive multitasking. You can even input the thread priority, receive whole objects on Progress_Changed.
And all this without the hassles of fighting with semaphores, queues and mutexes.
OK, clearly, you can’t let your code be reentrant to its own Bgw_DoWork. But we are talking about single instance background working.

Class Library Skeleton for the above Wait Class:

HV.Tools Class Library
Wait Members:
Waits on a separate thread and sends feedback on intervals.
The following tables list the members exposed by the Wait type.
Not all Args implement getters and setters in this version.

Public Constructor

Public Properties


Public Args

Public Methods

Protected Methods

Public Events


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: