public SchedulerEntry(ApproximateDateBlock dateBlock)
        {
            if (dateBlock == null)
            {
                throw new ArgumentNullException();
            }

            _dateBlock = dateBlock;
            _dateBlock.DateUpdated += _dateBlock_DateUpdated;
            _cachedUpdateTime = dateBlock.NextUpdate;
        }
 public static void Unregister(ApproximateDateBlock dateBlock)
 {
     lock (typeof(InOrderScheduler))
     {
         if (_instance == null) _instance = new InOrderScheduler();
     }
     Task.Run(new Action(() =>
     {
         _instance.InternalUnregister(dateBlock);
     }));
 }
 private void InternalRegister(ApproximateDateBlock dateBlock)
 {
     lock (this)
     {
         CancelCurrentUpdate();
         SchedulerEntry schedulerEntry = new SchedulerEntry(dateBlock);
         schedulerEntry.DateUpdated += OnDateUpdated;
         _set.Add(schedulerEntry.CachedNextUpdate, schedulerEntry);
         _lookupDict.Add(dateBlock, schedulerEntry);
         ScheduleNextUpdate();
     }
 }
 private void InternalUnregister(ApproximateDateBlock dateBlock)
 {
     SchedulerEntry schedulerEntry;
     lock (this)
     {
         if (_lookupDict.TryGetValue(dateBlock, out schedulerEntry))
         {
             CancelCurrentUpdate();
             _lookupDict.Remove(dateBlock);
             _set.Remove(schedulerEntry);
             ScheduleNextUpdate();
         }
     }
 }