// add a new schedule public static void AddSchedule(LedClientService.Schedule.Schedule s) { if (GetSchedule(s.schid) != null) throw new SchedulerException("Schedule with the same schid already exists"); m_schedulesList.Add(s); m_schedulesList.Sort(); // adjust the next event time if schedule is added at the top of the list if (m_schedulesList[0] == s) SetNextEventTime(); if (OnSchedulerEvent != null) OnSchedulerEvent(SchedulerEventType.CREATED, s.schid); #if DEBUG PrintScheduleInfo(); #endif }
// remove a schedule object from the list public static void RemoveSchedule(LedClientService.Schedule.Schedule s) { m_schedulesList.Remove(s); m_schedulesList.Sort(); SetNextEventTime(); if (OnSchedulerEvent != null) OnSchedulerEvent(SchedulerEventType.DELETED, s.schid); #if DEBUG PrintScheduleInfo(); #endif }