Beispiel #1
0
        /// <summary>
        /// Writes a task event to the log. 
        /// </summary>
        /// <param name="log"></param>
        /// <param name="task"> </param>
        public static void Task(this ILog log, ITask task)
        {
            var level = SupportedLoggingLevels.Task;
            if (task.SuppressLogging)
                level = SupportedLoggingLevels.Debug;

            log.Logger.Log(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType,
            level, task.GetFriendlyName(), null);
        }
Beispiel #2
0
        private IResult ExecuteCurrentTask(ITask currentTask, IResult previousResults, bool movingForward)
        {
            var performTask = PerformTask(currentTask, movingForward);
            if (!performTask.Result)
            {
                Log.DebugFormat("Skipping task ({0}): {1}", currentTask.GetFriendlyName(), performTask.Reason);
                return new SkipResult { SkipForward = movingForward };
            }

            Log.Task(currentTask);

            var startTime = DateTime.UtcNow;

            var result = currentTask.Execute(previousResults);
            result.FromTask = currentTask;

            DialogsManager.WaitForDurationOrCancel(
                startTime,
                new TimeSpan(0,0,0,currentTask.MinimumTaskTime));

            return result;
        }