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); }; }