Register() protected static method

protected static Register ( DelayedCall dc ) : void
dc DelayedCall
return void
        protected static void PrepareDCObject(DelayedCall dc, int milliseconds, bool async)
        {
            if (milliseconds < 0)
            {
                throw new ArgumentOutOfRangeException("milliseconds", "The new timeout must be 0 or greater.");
            }
            dc.context = null;
            if (!async)
            {
                dc.context = SynchronizationContext.Current;
                if (dc.context == null)
                {
                    throw new InvalidOperationException("Cannot delay calls synchronously on a non-UI thread. Use the *Async methods instead.");
                }
            }
            if (dc.context == null)
            {
                dc.context = new SynchronizationContext();
            }
            dc.timer = new System.Timers.Timer();
            if (milliseconds > 0)
            {
                dc.timer.Interval = (double)milliseconds;
            }
            dc.timer.AutoReset = false;
            DelayedCall delayedCall = dc;

            dc.timer.Elapsed += new ElapsedEventHandler(delayedCall.Timer_Elapsed);
            DelayedCall.Register(dc);
        }
 public void Start()
 {
     lock (this.timerLock)
     {
         this.cancelled = false;
         this.timer.Start();
         DelayedCall.Register(this);
     }
 }