我正在使用 Windows Workflow Foundation .NET 4.5.2。我有一个关于bool
从 CodeActivity 内部在设计器中设置类型参数(也可能是变量)的问题。
在设计器中,我将newProject
type的参数设置为bool
direction In
。(它应该有另一个方向吗?即InOut
)。
在代码中,我想将参数从设计器设置为 value true
。
public class Inquire : CodeActivity
{
public InArgument<bool> newProject { get; set; }
public InArgument<bool> rework { get; set; }
protected override void Execute(CodeActivityContext context)
{
Console.WriteLine("For a new project type 'new', for rework type 'rw'.");
string inquire = Console.ReadLine();
if (inquire == "new")
{
context.SetValue(newProject, true);
}
else
{
rework.Set(context, true);
}
}
}
设计器中的论点在使我能够进入下一个状态的转换中得到验证。如果是true
,我可以进入下一个状态。问题是设计器中的参数没有收到上面代码中设置的新值。怎么做到呢?