Beispiel #1
0
        /// <summary>
        ///     Post a task in the TasksProcessor
        /// </summary>
        /// <param name="task"></param>
        /// <remarks>Don't use TaskProcessor.Post directly to handle the OnBeforeTaskPost event</remarks>
        public void Post(SymuTask task)
        {
            if (task == null)
            {
                throw new ArgumentNullException(nameof(task));
            }

            // if filtering tasks here, we must unassigned the task otherwise the task would not be taken by anyone
            // for the moment it is not filtered
            if (!Cognitive.TasksAndPerformance.CanPerformTask) // || task.IsCancelledBy(Id)) //|| task.IsBlocked)
            {
                return;
            }

            OnBeforePostTask(task);
            TaskProcessor.Post(task);
            OnAfterPostTask(task);
        }
Beispiel #2
0
        /// <summary>
        ///     Post a task in the TasksProcessor
        /// </summary>
        /// <param name="tasks"></param>
        /// <remarks>Don't use TaskProcessor.Post directly to handle the OnBeforeTaskPost event</remarks>
        public void Post(IEnumerable <SymuTask> tasks)
        {
            if (tasks is null)
            {
                throw new ArgumentNullException(nameof(tasks));
            }

            if (!Cognitive.TasksAndPerformance.CanPerformTask)
            {
                return;
            }

            // if filtering tasks here, we must unassigned the task otherwise the task would not be taken by anyone
            // for the moment it is not filtered
            foreach (var task in tasks) //.Where(x => !x.IsCancelledBy(Id))) //.Where(x => !x.IsBlocked))
            {
                OnBeforePostTask(task);
                TaskProcessor.Post(task);
                OnAfterPostTask(task);
            }
        }