本文整理汇总了C#中ICommandExecutor.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# ICommandExecutor.Execute方法的具体用法?C# ICommandExecutor.Execute怎么用?C# ICommandExecutor.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICommandExecutor
的用法示例。
在下文中一共展示了ICommandExecutor.Execute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteCommands
public void ExecuteCommands(ObjectTypeId objectTypeId, ICommandExecutor commandExecutor, CompositeCommandExecutionContext compositeContext)
{
foreach (var command in commands)
{
var context = compositeContext.GetFor(command.TargetObjectId);
commandExecutor.Execute(command, context);
}
}
示例2: ExecuteCommands
public void ExecuteCommands(ObjectId targetObjectId, ICommandExecutor commandExecutor, ICommandExecutionContext context)
{
List<AbstractCommand> commandsForObject;
if (!commands.TryGetValue(targetObjectId, out commandsForObject))
{
return;
}
foreach (var command in commandsForObject)
{
commandExecutor.Execute(command, context);
}
}
示例3: UpdateDigest
/// <summary>
/// Updates the <see cref="ManifestDigest"/> in an <see cref="Implementation"/>.
/// </summary>
/// <param name="implementation">The <see cref="Implementation"/> to update.</param>
/// <param name="path">The path of the directory to generate the digest for.</param>
/// <param name="handler">A callback object used when the the user is to be informed about progress.</param>
/// <param name="executor">Used to apply properties in an undoable fashion.</param>
/// <param name="keepDownloads"><see langword="true"/> to store the directory as an implementation in the default <see cref="IStore"/>.</param>
/// <exception cref="OperationCanceledException">The user canceled the task.</exception>
/// <exception cref="IOException">There is a problem access a temporary file.</exception>
/// <exception cref="UnauthorizedAccessException">Read or write access to a temporary file is not permitted.</exception>
/// <exception cref="DigestMismatchException">An existing digest does not match the newly calculated one.</exception>
private static void UpdateDigest([NotNull] this Implementation implementation, [NotNull] string path, [NotNull] ITaskHandler handler, ICommandExecutor executor, bool keepDownloads = false)
{
var digest = GenerateDigest(path, handler, keepDownloads);
if (implementation.ManifestDigest == default(ManifestDigest))
executor.Execute(new SetValueCommand<ManifestDigest>(() => implementation.ManifestDigest, value => implementation.ManifestDigest = value, digest));
else if (!digest.PartialEquals(implementation.ManifestDigest))
throw new DigestMismatchException(implementation.ManifestDigest.ToString(), digest.ToString());
}
示例4: ConvertSha256ToSha256New
private static void ConvertSha256ToSha256New(Implementation implementation, ICommandExecutor executor)
{
if (string.IsNullOrEmpty(implementation.ManifestDigest.Sha256) || !string.IsNullOrEmpty(implementation.ManifestDigest.Sha256New)) return;
var digest = new ManifestDigest(
implementation.ManifestDigest.Sha1,
implementation.ManifestDigest.Sha1New,
implementation.ManifestDigest.Sha256,
implementation.ManifestDigest.Sha256.Base16Decode().Base32Encode());
executor.Execute(new SetValueCommand<ManifestDigest>(() => implementation.ManifestDigest, value => implementation.ManifestDigest = value, digest));
}