/// <summary> /// Adds scheduled action to list. /// </summary> /// <param name="action"></param> /// <param name="firstInMs"></param> /// <param name="regularInMs"></param> /// <returns></returns> public IDisposable ScheduleOnInterval(Action action, long firstInMs, long regularInMs) { StubScheduledAction toAdd = new StubScheduledAction(action, firstInMs, regularInMs, this._scheduled); this._scheduled.Add(toAdd); return(toAdd); }
/// <summary> /// Adds a scheduled action to the list. /// </summary> /// <param name="action"></param> /// <param name="firstInMs"></param> /// <returns></returns> public IDisposable Schedule(Action action, long firstInMs) { StubScheduledAction toAdd = new StubScheduledAction(action, firstInMs, this._scheduled); this._scheduled.Add(toAdd); return(toAdd); }
/// <summary> /// Execute all actions in the scheduled list. /// </summary> public void ExecuteAllScheduled() { StubScheduledAction[] array = this._scheduled.ToArray(); for (int i = 0; i < array.Length; i++) { StubScheduledAction scheduled = array[i]; scheduled.Execute(); } }