Пример #1
0
        private void CustomTimerProc(object state)
        {
            // The state object is the Timer object.
            CustomTimer t = (CustomTimer)state;

            Console.WriteLine("The custom timer with interval " + t.GetInterval() + " callback finished");
            t.Dispose();
        }
Пример #2
0
        public void StartCustomTimerAndStop()
        {
            CustomTimer t = new CustomTimer(new TimerCallback(CustomTimerProc));

            t.Start(10);
            // wait 2 seconds and stop it
            Thread.Sleep(2000);
            t.Stop();
        }
Пример #3
0
        public void StartCustomTimer()
        {
            CustomTimer t = new CustomTimer(new TimerCallback(CustomTimerProc));

            t.Start(10);
        }