[英]Setting the argument's value in workflow c#
我正在使用Windows Workflow Foundation .NET 4.5.2。 我从CodeActivity内部在设计器中设置bool
类型的参数(也可能是变量)时遇到问题。
在设计器中,我设置了方向为In
bool
类型的newProject
参数。 (它应该有另一个方向吗?即InOut
)。
在代码中,我想将设计器的参数设置为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
,我可以进入下一个状态。 问题在于设计器中的参数不会收到在上面的代码中设置的新值。 如何做呢?
如果要将值传递回设计器,则需要将其设为Out参数或InOut参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.