private static void ReportAction(ScheduledTaskChangedEventArgs e) { string message = null; switch (e.Action) { case ScheduledTaskChangedAction.Started: message = String.Format("{0} task scheduled: {1}ms", e.Key, e.Interval); break; case ScheduledTaskChangedAction.Stopped: message = String.Format("{0} task stopped", e.Key); break; case ScheduledTaskChangedAction.Running: message = String.Format("{0} task running", e.Key); break; case ScheduledTaskChangedAction.Finished: message = String.Format("{0} task finished: {1}ms", e.Key, e.Interval); break; case ScheduledTaskChangedAction.AlreadyInProgress: message = String.Format("{0} task already in progress", e.Key); break; } Assert.IsNotNull(message); Debug.WriteLine(message); }
private void TaskChanged(object sender, ScheduledTaskChangedEventArgs e) { switch (e.Action) { case ScheduledTaskChangedAction.Started: Logger.Info(e.ToString(i => $"{(int)TimeSpan.FromMilliseconds(i.GetValueOrDefault()).TotalMinutes} minutes")); break; case ScheduledTaskChangedAction.Faulted: Logger.Error(e.ToString()); break; case ScheduledTaskChangedAction.AlreadyInProgress: Logger.Warn(e.ToString()); break; default: Logger.Info(e.ToString()); break; } }