Пример #1
0
        /// <summary>
        /// Handles the elapsed event
        /// </summary>
        private void TimerElapsed(Object sender, EventArgs e)
        {
            TagTimer timer = ((TagTimer)sender);

            timer.Enabled = false;
            timer.Stop();
            timer.TimeoutHandler(timer.Tag as String);
        }
Пример #2
0
        /// <summary>
        /// Waits for timeout and calls method
        /// </summary>
        public void SetTimeout(TimeoutDelegate timeoutHandler, String tag, Int32 timeout)
        {
            TagTimer timer = new TagTimer();

            timer.Interval       = timeout;
            timer.Tick          += this.TimerElapsed;
            timer.Tag            = tag;
            timer.TimeoutHandler = timeoutHandler;
            timer.Start();
        }