Example #1
0
        /// <summary>
        /// Creates a new <see cref="PickBranch"/> that waits for the given bookmark.
        /// </summary>
        /// <param name="pick"></param>
        /// <param name="bookmarkName"></param>
        /// <returns></returns>
        public static Pick BranchWait(this Pick pick, InArgument <string> bookmarkName)
        {
            if (pick == null)
            {
                throw new ArgumentNullException(nameof(pick));
            }
            if (bookmarkName == null)
            {
                throw new ArgumentNullException(nameof(bookmarkName));
            }

            return(pick.Branch(Wait(bookmarkName)));
        }
Example #2
0
        /// <summary>
        /// Creates a new <see cref="PickBranch"/> with the given <paramref name="trigger"/>.
        /// </summary>
        /// <param name="pick"></param>
        /// <param name="trigger"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        public static Pick Branch(this Pick pick, Func <Task> trigger)
        {
            if (pick == null)
            {
                throw new ArgumentNullException(nameof(pick));
            }
            if (trigger == null)
            {
                throw new ArgumentNullException(nameof(trigger));
            }

            return(pick.Branch(Invoke(trigger)));
        }
Example #3
0
        /// <summary>
        /// Creates a new <see cref="Pick"/> that waits for any of the given <see cref="Activity"/>s to complete.
        /// </summary>
        /// <param name="activities"></param>
        /// <returns></returns>
        public static Pick PickAny(params Activity[] activities)
        {
            if (activities == null)
            {
                throw new ArgumentNullException(nameof(activities));
            }

            var pick = new Pick();

            foreach (var activity in activities)
            {
                pick.Branch(activity);
            }

            return(pick);
        }