示例#1
0
        /// <summary>
        /// Executes this macro command.
        /// </summary>
        /// <param name="serviceProvider">Interface to service provider</param>
        /// <param name="context">User defined context data</param>
        /// <returns>
        /// Returns a <see cref="CommandResult"/> object that describes
        /// the result.
        /// </returns>
        public override CommandResult Execute(IServiceProvider serviceProvider, object context)
        {
            var commandRes = new MacroCommandResult();

            foreach (var command in this.Commands)
            {
                var curCommandRes = command.Execute(serviceProvider, context);
                commandRes.CommandResults.Add(curCommandRes);
            }

            return(commandRes);
        }
示例#2
0
        /// <summary>
        /// Executes this macro command asynchronously.
        /// </summary>
        /// <param name="serviceProvider">Interface to service provider</param>
        /// <param name="context">User defined context data</param>
        /// <returns>
        /// Returns a <see cref="CommandResult"/> object that describes
        /// the result.
        /// </returns>
        public override async Task <CommandResult> ExecuteAsync(IServiceProvider serviceProvider, object context)
        {
            var commandRes = new MacroCommandResult();

            foreach (var command in this.Commands)
            {
                var curCommandRes = await command.ExecuteAsync(serviceProvider, context);

                commandRes.CommandResults.Add(curCommandRes);
            }

            return(commandRes);
        }