Exemple #1
0
        private void ReportAction(ScheduledTaskChangedEventArgs e)
        {
            switch (e.Action)
            {
            case ScheduledTaskChangedAction.Started:
                Logger.InfoFormat("{0} task scheduled: {1} minutes", e.Key, (int)(e.Interval / Constants.MinToMillisec));
                break;

            case ScheduledTaskChangedAction.Stopped:
                Logger.InfoFormat("{0} task stopped", e.Key);
                break;

            case ScheduledTaskChangedAction.Running:
                Logger.InfoFormat("{0} task running", e.Key);
                break;

            case ScheduledTaskChangedAction.Finished:
                Logger.InfoFormat("{0} task finished: {1:#,##0} ms", e.Key, e.Interval);
                break;

            case ScheduledTaskChangedAction.AlreadyInProgress:
                Logger.WarnFormat("{0} task already in progress", e.Key);
                break;
            }
        }
Exemple #2
0
        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 OnTaskChanged(object s, ScheduledTaskChangedEventArgs e)
        {
            var handler = Changed;

            if (handler != null)
            {
                handler(s, e);
            }
        }
        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;
            }
        }
Exemple #5
0
 private static void TaskChanged(object sender, ScheduledTaskChangedEventArgs e)
 {
     Console.WriteLine(e.ToString());
 }