本文整理汇总了C#中Command.Do方法的典型用法代码示例。如果您正苦于以下问题:C# Command.Do方法的具体用法?C# Command.Do怎么用?C# Command.Do使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Command
的用法示例。
在下文中一共展示了Command.Do方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteOneCommand
/// <summary>
///
/// </summary>
/// <param name="command"></param>
/// <param name="commandQueue"></param>
/// <remarks>internal nur, um in den Tests ranzukommen</remarks>
internal CommandResult ExecuteOneCommand(Command command, BlockingCollection<Command> queue)
{
_logger.Info("Starting Command {Command} for package {Package}", command, command.PackageName);
var result = command.Do();
_logger.Debug("Finished Command {Command} with result: {Result}", command, result);
if (result.Successful && command.RunAfterCompletedWithResultTrue != null)
{
command.RunAfterCompletedWithResultTrue.AddResultsOfPreviousCommands(command.ResultsOfPreviousCommands.Concat(new[] { result }));
queue.Add(command.RunAfterCompletedWithResultTrue);
}
else if (!result.Successful && command.RunAfterCompletedWithResultFalse != null)
{
command.RunAfterCompletedWithResultFalse.AddResultsOfPreviousCommands(command.ResultsOfPreviousCommands.Concat(new[] { result }));
queue.Add(command.RunAfterCompletedWithResultFalse);
}
return result;
}
示例2: Do
public void Do(Command command)
{
command.Do();
redo.Clear();
undo.Push(command);
}