4 people following this project (follow)

Project Description
AptusSoftware.Threading is a class library designed primarily to assist in the development of multi-threaded WinForm applications, although there is no technical reason why it could not be employed in other application types.

In a nutshell:
  • Inherit AsynchronousProcess and override DoWork().
  • In DoWork() write code to a) do the work, obviously, b) report progress, and c) check to see if the process has received an abort request if appropriate.
  • Instantiate the AsynchronousProcess (inherits Component so is designable), bind to the events (OnComplete etc) and call Start(), which will internally create a new thread and return immediately.
  • All AsynchronousProcess events will be fired on the same thread that called Start(), thus absolving the client of the responsibility of invoking any thread sensitive code (WinForm UI) on the correct thread.

Additionally you may want to:
  • Instantiate a CompositeAsynchronousProcess, such as ConcurrentAsynchronousProcess or SequentialAsynchronousProcess.
  • Set CompositeAsynchronousProcess.Processes with the processes you want it to execute.
  • Work with the composite as you would the singular, they both implement IAsynchronousProcess.
  • CompositeAsynchronousProcess automatically calculates the aggregate percentage complete when reporting progress.

The best place to start is to look at the Test Harness project which is part of the source code download (VS 2008 Solution).

Last edited Feb 25 2010 at 3:57 PM by Myl0, version 9