HV-Lima Peru

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

Category Archives: .NET Framework

Visual Studio 2008 and .NET Framework 3.5 Training Kit

Have a look at the freshly released .NET Framework 3.5 Training

 

After unzipping the Training Kit it feels like a Training CD on your hard disk.

Great Presentations, Demos and Labs

Advertisements

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