ARCed.Controls.HighPrecisionTimer.Start C# (CSharp) Метод

Start() публичный Метод

Starts the timer.
/// The timer has already been disposed. /// /// The timer failed to start. ///
public Start ( ) : void
Результат void
        public void Start()
        {
            #region Require

            if (this.disposed)
            {
                throw new ObjectDisposedException("Timer");
            }

            #endregion

            #region Guard

            if (this.IsRunning)
            {
                return;
            }

            #endregion

            // If the periodic event callback should be used.
            if (this.Mode == TimerMode.Periodic)
            {
                // Create and start timer.
                this.timerID = timeSetEvent(this.Period, this.Resolution, this.timeProcPeriodic, 0, (int)this.Mode);
            }
            // Else the one shot event callback should be used.
            else
            {
                // Create and start timer.
                this.timerID = timeSetEvent(this.Period, this.Resolution, this.timeProcOneShot, 0, (int)this.Mode);
            }

            // If the timer was created successfully.
            if (this.timerID != 0)
            {
                this.running = true;

                if (this.SynchronizingObject != null && this.SynchronizingObject.InvokeRequired)
                {
                    this.SynchronizingObject.BeginInvoke(
                        new EventRaiser(this.OnStarted),
                        new object[] { EventArgs.Empty });
                }
                else
                {
                    this.OnStarted(EventArgs.Empty);
                }
            }
            else
            {
                throw new TimerStartException("Unable to start multimedia Timer.");
            }
        }