private static void RemoveRunning(ScheduleBase schedule)
        {
            try
            {
                string scheduleName = schedule.Name;

                if (_elapseExpires.HasKey(scheduleName))
                {
                    lock (_elapseExpiresSyncLock)
                    {
                        if (_elapseExpires.HasKey(scheduleName))
                        {
                            _elapseExpires.Remove(scheduleName);
                        }
                    }
                }
            }
            catch
            {
                // do nothing.
            }
        }
        public static void RemoveSchedule(ScheduleBase schedule)
        {
            lock (_schedulesSyncLock)
            {
                try
                {
                    if (_schedules.HasKey(schedule.Name))
                    {
                        _schedules.Remove(schedule.Name);
                    }
                }
                catch (Exception)
                {
                    // _logger.Error(e.Message);
                }
            }

            if (_addedSchedules != null)
            {
                lock (_addedSchedulesSyncLock)
                {
                    if (_addedSchedules.HasKey(schedule.Name))
                    {
                        _addedSchedules.Remove(schedule.Name);
                    }
                }
            }
        }
 public static void DeleteSchedule(ScheduleBase schedule)
 {
     _provider.DeleteSchedule(schedule);
 }
        public static void AddSchedule(ScheduleBase schedule)
        {
            lock (_schedulesSyncLock)
            {
                try
                {
                    _schedules.Add(schedule);
                }
                catch (Exception)
                {
                    //_logger.Error(e.Message);
                }
            }

            if (_addedSchedules == null)
            {
                lock (_addedSchedulesSyncLock)
                {
                    if (_addedSchedules == null)
                    {
                        _addedSchedules = new ScheduleCollection();
                    }
                }
            }

            _addedSchedules.Add(schedule);
        }
 /// <summary>
 /// Creates a new instance of type <see cref="ScheduleEventArgs"/>.
 /// </summary>
 public ScheduleEventArgs(ScheduleBase schedule, ScheduleSettings settings)
 {
     _schedule = schedule;
     _settings = settings;
 }