Esempio n. 1
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;
 }
Esempio n. 2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Alarm" /> class.
 /// </summary>
 /// <param name="settings">The settings to configure the alarm with.</param>
 /// <param name="name">The name of the alarm.</param>
 public Alarm
     (IAlarmSettings settings,
     string name)
 {
     Name      = name;
     AlarmTime = settings.AlarmTime;
     Repeat    = settings.Repeat;
     _timer    =
         new SynchronizedTimer(
             SynchronizationContext.Current)
     {
         Interval = 60000
     };
     _timer.Elapsed += OnElapsed;
 }