C# 设置参数';工作流c中的s值# 我使用Windows工作流基金会.NET4.5.2。 关于从CodeActivity内部在designer中设置类型为bool(也可以是变量)的参数,我有一个问题
在设计器中,我将C# 设置参数';工作流c中的s值# 我使用Windows工作流基金会.NET4.5.2。 关于从CodeActivity内部在designer中设置类型为bool(也可以是变量)的参数,我有一个问题,c#,parameter-passing,workflow-foundation,setvalue,workflow-foundation-4.5,C#,Parameter Passing,Workflow Foundation,Setvalue,Workflow Foundation 4.5,在设计器中,我将newProject类型为bool的参数newProject设置为directionIn。(它应该有另一个方向吗?例如,InOut) 在代码中,我想将参数从设计器设置为valuetrue public class Inquire : CodeActivity { public InArgument<bool> newProject { get; set; } public InArgument<bool> rework { get;
newProject
类型为bool
的参数newProject
设置为directionIn
。(它应该有另一个方向吗?例如,InOut
)
在代码中,我想将参数从设计器设置为valuetrue
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);
}
}
}
公共类查询:CodeActivity
{
公共InArgument新建项目{get;set;}
公共InArgument返工{get;set;}
受保护的覆盖无效执行(CodeActivityContext上下文)
{
WriteLine(“对于新项目类型'new',对于返工类型'rw'”;
字符串inquire=Console.ReadLine();
如果(查询==“新建”)
{
SetValue(newProject,true);
}
其他的
{
设置(上下文,true);
}
}
}
设计器中的参数在转换中得到验证,使我能够进入下一个状态。如果它是true
,我可以进入下一个状态。
问题是设计器中的参数没有收到上面代码中设置的新值。怎样才能做到呢 如果要将值传回设计器,则需要将其设置为out参数或InOut参数。如果要将值传回设计器,则需要将其设置为out参数或InOut参数。我在设计器和代码中设置了它,但不起作用。我尝试了InOut和Out。我在设计器和代码中设置了它,但都不起作用。我试着用输入和输出。