Thursday 22 September 2011

DBI Technologies Multi Threading with Studio Controls for .NET


Hello All,

For Today's Tech Tip, we thought we would branch out from just showcasing the great built in features of our controls and show off some .NET functionality that can be applied to numerous scenarios involving many different controls and applications.

Multi-Threading

The basic concept for multi-threading is to take the major processing away from the main application thread (to avoid the dreaded "Not Responding" message from windows), and also to be able to give proper feedback to users as tasks process and complete.

A nice and easy way to reflect the current status of an operation is with, everyone's favorite control, the Progress Bar. The Progress Bar is universally understood, well if you are used to using computers at least :), and a very simple way to display the needed information.  The issue that arises when trying to use it, is that trying to perform your processing and updating the Progress Bar, will max out the current thread and bring the application to its knees.  This is where Multi-Threading comes in, because you can move ALL of the processing operations to new threads, and leave the main thread to refresh the Progress Bar with the progress as each thread reports back.

We have put together a small sample that shows using two threads for "processing" in addition to the main application thread.

This sample uses the following controls, on a single form:

2 dbiMeter controls (used as Progress Bars)
1 dbiDial control (used to modify the increment of 1 dbiMeter)
1 dbiSlide control (used to modify the increment of 1 dbiMeter)
4 standard button controls (used for starting and stopping the additional threads)
2 Background Worker controls (these controls will handle the additional threads).

get the full details and the code right here:
http://www.dbi-tech.com/HowTo/StudioControldotNet_MultiThreading.html

More software components information DBI Technologies and Multi Threading with Studio Controls for .NET  from Softheware.com.

No comments:

Post a Comment