P
P. Gorecki
Hi,
I have a Sender and Reciever classes. I want the sender to send events
to reciever but given a condition specified by reciever.
For example, lets assume that sender is a keyboard and a reciever is a
console. Lets assume that keyboard sends event every time key is
pressed:
Standard way of adding event handlers:
//somewhere in console class initialization
keyboard.EventHandler += new SomeEventDelegate(this.OnEvent);
Now, if key is pressed, console will recieve an event from keyboard
and the key code can be included in SomeEventArgs structure.
The big question is, how can console provide information to the
keyboard on which keys it wants to listen (recieve events), in other
words to have something like this:
//somewhere in console class initialization
keyboard.AddHandler(this.OnSpecificKeyPressed, key);
I have a Sender and Reciever classes. I want the sender to send events
to reciever but given a condition specified by reciever.
For example, lets assume that sender is a keyboard and a reciever is a
console. Lets assume that keyboard sends event every time key is
pressed:
Standard way of adding event handlers:
//somewhere in console class initialization
keyboard.EventHandler += new SomeEventDelegate(this.OnEvent);
Now, if key is pressed, console will recieve an event from keyboard
and the key code can be included in SomeEventArgs structure.
The big question is, how can console provide information to the
keyboard on which keys it wants to listen (recieve events), in other
words to have something like this:
//somewhere in console class initialization
keyboard.AddHandler(this.OnSpecificKeyPressed, key);