async Task <bool> IAction.CanInvoke() { if (CanInvoke.HasDelegate) { var arg = new ComputeResultEventArg <bool>(); await CanInvoke.InvokeAsync(arg); if (arg.IsSet) { return(arg.Result); } } return(true); }
public override string ToString() { StringBuilder sb = new StringBuilder(); if (RedirectedStandardInput != null) { sb.AppendLine(RedirectedStandardInput.ToString()) .AppendLine("WILL BE REDIRECTED TO"); } sb.AppendLine("{") .Append(" FilePath = ") .Append(FilePath == null ? "(null)" : FilePath) .AppendLine(",") .Append(" BaseDirectory = ") .Append(BaseDirectory == null ? "(null)" : BaseDirectory) .AppendLine(",") .Append(" WorkingDirectory = ") .Append(WorkingDirectory == null ? "(null)" : WorkingDirectory) .AppendLine(",") .Append(" RedirectedStandardError = ") .Append(RedirectedStandardError == null ? "(null)" : RedirectedStandardError) .AppendLine(",") .Append(" StandardErrorAppend = ") .Append(StandardErrorAppend == null ? "(null)" : StandardErrorAppend.ToString()) .AppendLine(",") .Append(" CanInvoke = ") .AppendLine(CanInvoke.ToString()) .AppendLine("}") .Append("Arguments:"); if (arguments.Count == 0) { sb.AppendLine().Append(" (empty)"); } else { foreach (string s in arguments) { sb.AppendLine().Append(" ").Append(s); } } return(sb.ToString()); }