[dba-VB] exposing child class events

jwcolby jwcolby at colbyconsulting.com
Wed Sep 26 09:08:17 CDT 2012


I have a timer class clsTimer which wraps a timer with synchronization stuff to prevent re-entry.  
It raises an evTimer. This clsTimer is child to clsRunstate.  clsRunState sinks the evTimer and 
raises its own evTimer, simply passing the timer event out to the application using clsRunState.

Is it possible to simply expose the clsTimer's event?  clsRunState has do the full on delegate thing 
in order to raise the event so I end up with a delegate in the clsTimer and another delegate in 
clsRunState.  It works but it just seems clumsy (and verbose).

IOW I have this in clsRunState

         public delegate void delEvTimer(object sender);
         public event delEvTimer evTimer;

         /// <summary>
         /// Sinks the timer class' event and simply raises its own event for the application to use
         /// </summary>
         void cTimer_evTimer()
         {
             evTimer(this);      //Start the timer thread business in the consuming application.
         }

-- 
John W. Colby
Colby Consulting

Reality is what refuses to go away
when you do not believe in it




More information about the dba-VB mailing list