コード例 #1
0
ファイル: TimerManager.cs プロジェクト: mousebyte/MouseNet
 public TimerManager()
 {
     _alarms          = new NamedObjectList <Alarm>();
     _counter         = new Counter(SynchronizationContext.Current);
     _elapsedHandlers = new NamedObjectList <ElapsedHandler>();
     _tickHandlers    = new NamedObjectList <TickHandler>();
 }
コード例 #2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Counter" /> class.
 /// </summary>
 /// <param name="context">
 ///     The synchronization context to use when creating
 ///     the timer.
 /// </param>
 public Counter
     (SynchronizationContext context)
 {
     _alarms = new NamedObjectList <CounterInstance>();
     _timer  = new SynchronizedTimer(context)
     {
         Interval = (int)OneSecond.TotalMilliseconds
     };
     _timer.Elapsed += OnTick;
 }