Betzalel.SimpleMulticastAnalyzer.Infrastructure.HighResolutionTimer.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 (disposed)
              {
            throw new ObjectDisposedException("Timer");
              }

              #endregion

              #region Guard

              if (IsRunning)
              {
            return;
              }

              #endregion

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

              // If the timer was created successfully.
              if (timerID == 0)
            throw new TimerStartException("Unable to start multimedia Timer.");

              running = true;

              if (IsAsync)
              {
            Task.Factory.StartNew(() => OnStarted(new EventArgs()));
              }
              else
              {
            OnStarted(EventArgs.Empty);
              }
        }