T
Tom
Dear experts,
this time my problem is, that I will have objects of 3 different
classes, which all should receive their events without knowing each
other.
In real life the following happens:
I have three fingerprints which are waiting for a finger to be put on
sensor.
As soon as the first fingerprint reckognizes a finger, all the others
should be shutten down.
In code the following happens:
scannerX x = new scannerX();
//Start the wait for finger proc in a thread
x.IsFingerPresent();
scannerY y = new scannerY();
//Start the wait for finger proc in a thread
y.IsFingerPresent();
scannerZ z = new scannerZ();
//Start the wait for finger proc in a thread
z.IsFingerPresent();
//IsFingerPresent does the following:
// System.Threading.Thread t = null;
// t = new Thread(new ThreadStart(this.ScanImage))
// t.Start();
// ScanImage waits for some things to happen and if a finger is
detected,
// it raises an eventproc.
The concrete problem now is:
I can not add an eventhandler of y (scannerY) to z (scannerZ) because
z does not even know that y exists (there is no reference to y).
Is there a way to do something like a global/static eventhandler
which could be used by all objects in my application and could be
raised from anywhere out of my app ?
Thanks for any help !!
Greets
Tom
this time my problem is, that I will have objects of 3 different
classes, which all should receive their events without knowing each
other.
In real life the following happens:
I have three fingerprints which are waiting for a finger to be put on
sensor.
As soon as the first fingerprint reckognizes a finger, all the others
should be shutten down.
In code the following happens:
scannerX x = new scannerX();
//Start the wait for finger proc in a thread
x.IsFingerPresent();
scannerY y = new scannerY();
//Start the wait for finger proc in a thread
y.IsFingerPresent();
scannerZ z = new scannerZ();
//Start the wait for finger proc in a thread
z.IsFingerPresent();
//IsFingerPresent does the following:
// System.Threading.Thread t = null;
// t = new Thread(new ThreadStart(this.ScanImage))
// t.Start();
// ScanImage waits for some things to happen and if a finger is
detected,
// it raises an eventproc.
The concrete problem now is:
I can not add an eventhandler of y (scannerY) to z (scannerZ) because
z does not even know that y exists (there is no reference to y).
Is there a way to do something like a global/static eventhandler
which could be used by all objects in my application and could be
raised from anywhere out of my app ?
Thanks for any help !!
Greets
Tom