using System; namespace ZeroLevel.Services.Shedulling { public interface ISheduller : IDisposable { #region One time events long RemindAfter(TimeSpan timespan, Action callback); long RemindAt(DateTime date, Action callback); #endregion One time events #region Repitable behaviour /// /// Performs an action once a period, while the period is recalculated according to the transferred function at each re-creation of the task. /// /// Function to calculate the next period /// Action /// Task ID long RemindEveryNonlinearPeriod(Func nextEventPeriodCalcFunction, Action callback, bool breakWherError = false); /// /// Performs an action once a period, while the period is recalculated according to the transferred function at each re-creation of the task. /// /// The function to calculate the period to the first execution /// The function for calculating the period until subsequent performances /// Action /// Task ID long RemindEveryNonlinearPeriod(Func firstEventPeriodCalcFunction, Func nextEventPeriodCalcFunction, Action callback, bool breakWherError = false); /// /// Performs an action once per period, while the date is recalculated from the function transferred each time the task is recreated. /// /// The function to calculate the next date /// Action /// Task ID long RemindEveryNonlinearDate(Func nextEventDateCalcFunction, Action callback, bool breakWherError = false); long RemindEveryNonlinearDate(DateTime firstTime, Func nextEventDateCalcFunction, Action callback, bool breakWherError = false); /// /// Performs an action once per period, while the date is recalculated from the function transferred each time the task is recreated. /// /// The function to calculate the first run date /// The function to calculate the next date /// Action /// Task ID long RemindEveryNonlinearDate(Func firstEventDateCalcFunction, Func nextEventDateCalcFunction, Action callback, bool breakWherError = false); /// /// Performs an action once in a specified period /// /// Period /// Action /// Task ID long RemindEvery(TimeSpan timespan, Action callback, bool breakWherError = false); /// /// Performs an action once in a specified period /// /// Period to first run /// Period /// Action /// Task ID long RemindEvery(TimeSpan first, TimeSpan next, Action callback, bool breakWherError = false); long RemindWhile(TimeSpan period, Func callback, Action continueWith = null, bool breakWherError = false); #endregion Repitable behaviour #region Sheduller control void Pause(); void Resume(); void Clean(); bool Remove(long key); #endregion Sheduller control } }