// Initialize and start event simulator
        private void StartEventSimulator()
        {
            m_autoEvent = new AutoResetEvent(true);
            m_eventSim = new EventSimulator(this);

            // Create the delegate that invokes methods for the timer.
            TimerCallback timerDelegate = new TimerCallback(m_eventSim.SendEvent);

            m_stateTimer = new Timer(timerDelegate, m_autoEvent, 10000, 20000);
            return;
        }
Esempio n. 2
0
        // Initialize and start event simulator
        private void StartEventSimulator()
        {
            m_autoEvent = new AutoResetEvent(true);
            m_eventSim  = new EventSimulator(this);

            // Create the delegate that invokes methods for the timer.
            TimerCallback timerDelegate = new TimerCallback(m_eventSim.SendEvent);

            m_stateTimer = new Timer(timerDelegate, m_autoEvent, 10000, 20000);
            return;
        }
 // Release resources used by this object
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         StopEventSimulator();
         m_autoEvent = null;
         m_eventSim = null;
         m_stateTimer = null;
     }
     // no unmanaged resources to release
 }
Esempio n. 4
0
 // Release resources used by this object
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         StopEventSimulator();
         m_autoEvent  = null;
         m_eventSim   = null;
         m_stateTimer = null;
     }
     // no unmanaged resources to release
 }