예제 #1
0
        /// <summary>
        /// Stop the agent, using the default StopContext
        /// </summary>
        /// <param name="agent"></param>
        /// <param name="reason">The reason for stopping the agent</param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public static Task Stop(this IAgent agent, string reason, CancellationToken cancellationToken = default)
        {
            var stopContext = new DefaultStopContext(cancellationToken)
            {
                Reason = reason
            };

            return(agent.Stop(stopContext));
        }
예제 #2
0
        /// <summary>
        /// Stop the agent, using the default StopContext
        /// </summary>
        /// <param name="agent"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public static Task Stop(this IAgent agent, CancellationToken cancellationToken = default(CancellationToken))
        {
            var stopContext = new DefaultStopContext(cancellationToken)
            {
                Reason = "Stopped"
            };

            return(agent.Stop(stopContext));
        }