Example #1
0
        /// <summary>
        /// Decorates with triggers (as ICondition) for task state transitions.  Does not change the behaviour at all, just adds new behaviour
        /// in CheckTriggers that will examine the trigger conditions and perform a state transition method if the condition is true.
        /// </summary>
        /// <param name="task"></param>
        /// <returns></returns>
        public static IHasConditionalTaskTriggers Triggered(this ITask task)
        {
            Condition.Requires(task).IsNotNull();

            var rv = task.As <ConditionalTriggerDecoration>();

            if (rv == null)
            {
                rv = new ConditionalTriggerDecoration(task);
            }

            return(rv);
        }
        /// <summary>
        /// Decorates with triggers (as ICondition) for task state transitions.  Does not change the behaviour at all, just adds new behaviour
        /// in CheckTriggers that will examine the trigger conditions and perform a state transition method if the condition is true.
        /// </summary>
        /// <param name="task"></param>
        /// <returns></returns>
        public static IHasConditionalTaskTriggers Triggered(this ITask task)
        {
            Condition.Requires(task).IsNotNull();

            var rv = task.As<ConditionalTriggerDecoration>();
            if (rv == null)
                rv = new ConditionalTriggerDecoration(task);

            return rv;
        }