public MethodProcessor(TimerEventArgs timer, TaskTimeStarted taskTimeStarted, Action <string> taskTimeEnded) { Timer = timer; TaskTimeStarted = taskTimeStarted; TaskTimeEnded = taskTimeEnded; TimerStarted = (object sender, TimerEventArgs e) => OnTimerStart(e); TimerChanged = (object sender, TimerEventArgs e) => OnTimerTick(e); TimerEnded = (object sender, TimerEventArgs e) => OnTimerEnd(e); }
public DelegateProcessor(TimerEventArgs timer, TaskTimeStarted taskTimeStarted, Action <string> taskTimeEnded) { Timer = timer; TimeStarted = taskTimeStarted; TaskTimeEnded = taskTimeEnded; TimerStarted = delegate(object sender, TimerEventArgs e) { TimeStarted(e.Name, e.SecondsAmount); }; TimerChanged = delegate(object sender, TimerEventArgs e) { int realSeconds = DateTime.Now.Second; Console.WriteLine("[{0}]:Timer: {1}: {2} seconds remaining", realSeconds, e.Name, e.SecondsAmount); }; TimerEnded = delegate(object sender, TimerEventArgs e) { TaskTimeEnded(e.Name); }; }
public virtual void OnTimerEnd(TimerEventArgs e) { TaskTimeEnded(e.Name); }
public virtual void OnTimerTick(TimerEventArgs e) { int realSeconds = DateTime.Now.Second; Console.WriteLine("[{0}]:Timer: {1}: {2} seconds remaining", realSeconds, e.Name, e.SecondsAmount); }
public virtual void OnTimerStart(TimerEventArgs e) { TaskTimeStarted(e.Name, e.SecondsAmount); }
/// <summary> /// Method which will be executed when event will be rised. /// </summary> /// <param name="sender">Event owner.</param> /// <param name="e">Event arguments.</param> public void OnTimerTimeout(object sender, TimerEventArgs e) { Console.WriteLine("Second listener job after {0} seconds.", e.Seconds); }
/// <summary> /// Raises Timeout event. /// </summary> /// <param name="sender">Event owner.</param> /// <param name="e">Event arguments.</param> protected virtual void OnTimeout(object sender, TimerEventArgs e) => this.Timeout?.Invoke(sender, e);