using System; using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; namespace PepperDash.Essentials.Core { public static class JobTimer { static CTimer MinuteTimer; static List Items = new List(); /// /// /// /// public static void AddAction(Action act) { } /// /// /// /// /// public static void AddJobTimerItem(JobTimerItem item) { var existing = Items.FirstOrDefault(i => i.Key == item.Key); if (existing != null) { Items.Remove(existing); } Items.Add(item); } static void CheckAndRunTimer() { if (Items.Count > 0 && MinuteTimer == null) { MinuteTimer = new CTimer(o => MinuteTimerCallback(), null, 60000, 60000); } } static void MinuteTimerCallback() { } } /// /// /// public class JobTimerItem { public string Key { get; private set; } public Action JobAction { get; private set; } public eJobTimerCycleTypes CycleType { get; private set; } /// /// /// public DateTime RunNextAt { get; set; } public JobTimerItem(string key, eJobTimerCycleTypes cycle, Action act) { } } public enum eJobTimerCycleTypes { RunEveryDay, RunEveryHour, RunEveryHalfHour, RunEveryMinute } }