Delegates/Messaging Uncoupling Threaded Applications

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I currently have a .NET Form application which has a seperate thread invoking
delegates of the MainForm in order to have the main thread update the form's
controls.

I would like to move the secondary thread's behavior into another class, eg.
MyClass, but I would like MyClass to be completely uncoupled from the form,
so that it might be re-used in another application setting, eg. a service.

What is the .NET paradigm for "communicating" between objects, so that I
don't have to include, for instance, references to a delegate of a MainForm
method within MyClass? Or am I ignorant of some feature of the .NET delegate
paradigm?

Any help, or directions to reading, would be greatly appreciated.
 
James Smyth said:
I currently have a .NET Form application which has a seperate thread invoking
delegates of the MainForm in order to have the main thread update the form's
controls.

I would like to move the secondary thread's behavior into another class, eg.
MyClass, but I would like MyClass to be completely uncoupled from the form,
so that it might be re-used in another application setting, eg. a service.

What is the .NET paradigm for "communicating" between objects, so that I
don't have to include, for instance, references to a delegate of a MainForm
method within MyClass? Or am I ignorant of some feature of the .NET delegate
paradigm?

Any help, or directions to reading, would be greatly appreciated.

Delegates don't need to be tied to any particular class. EventHandler
is a good example of this - any class can use it, any class can create
one.
 
Back
Top