/// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 /// <filterpriority>2</filterpriority>
 public void Dispose()
 {
     if (_liveMode)
     {
         _realTimeScheduleEventService.NewEvent -= _newDataAvailableHandler;
         _realTimeScheduleEventService.DisposeSafely();
     }
 }
Beispiel #2
0
        public void Accuracy()
        {
            var          scheduledEventService = new RealTimeScheduleEventService(RealTimeProvider.Instance);
            EventHandler handler = (_, __) =>
            {
                Log.Trace($"{DateTime.UtcNow:O}");

                var now           = DateTime.UtcNow;
                var nextEventTime = now.RoundDown(TimeSpan.FromSeconds(1)).Add(TimeSpan.FromSeconds(1) + TimeSpan.FromMilliseconds(101));
                scheduledEventService.ScheduleEvent(nextEventTime - now, now);
            };

            scheduledEventService.NewEvent += handler;
            handler(this, null);
            Thread.Sleep(5000);
            scheduledEventService.DisposeSafely();
        }