I was wandering is it possible to start a timer or perform an operation when you register to an event (from the events POV)? In other words I have an event that gets triggered on a timer, however I only want the Timer to start when a function registers to this specific event, thus if the user never registers to the event the timer never start. And conversely when the user unregisters from the event and it is the last registered function the time stops.
Thanks
I was wandering is it possible to start a timer or perform an operation
Share
You simply need to implement the add and remove accessors for the event. Generally they are implied, but you can explicitly implement them.
The link below has a tutorial about it.
http://www.switchonthecode.com/tutorials/csharp-tutorial-event-accessors&ei=ZYGtUMWOCPGFyQHU84H4Ag&usg=AFQjCNE5RG2taqNrJROy6P6Jpog3UNkvzQ