コード例 #1
0
        /// <summary>
        /// Starts this instance.
        /// </summary>
        public void Start()
        {
            TimerTickEvenArgs tickArgs = new TimerTickEvenArgs("Тик...так");

            while (Time != 0)
            {
                Thread.Sleep(TimeSpan.FromSeconds(1));
                Time--;
                OnTick(this, tickArgs);
            }

            OnElapsed(this, new TimerElapsedEvenArgs());
        }
コード例 #2
0
 /// <summary>
 /// Called when [tick].
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="eventArgs">The event arguments.</param>
 private void OnTick(object sender, TimerTickEvenArgs eventArgs)
 {
     TimerTick?.Invoke(this, eventArgs);
 }