我想在我的 Activity 中使用 InArgument
参数。我使用 expressionTextBox
在 XAML 代码中显示和使用 InArgument
值。我的问题是我声明一个变量并将其分配给活动库设计器中的这个表达式文本框
。在活动的 Execute() 方法中,我更改了 InArgument 参数的值 - 我希望变量值也更改。我该怎么做呢?
我的代码是这样的...
...
public InArgument<string> AcceptedForms{ get; set; }
...
protected override void Execute(CodeActivityContext context)
{
...
string AForms= "#AcceptedForms_"+ this.Id;
AcceptedForms.Set(context, AForms);
...
}
更改其值后,我可以在此方法中使用 AcceptedForms
的值。但它不会传递给我在活动库设计器中分配给它的变量。我想在另一个活动中使用它的价值。
I want to use an InArgument
parameter in my Activity. I use an expressionTextBox
to showing and using the InArgument
value in XAML code. My problem is this I declare a variable and assign it to this expressiontextbox
in Activity Library designer. When in the Execute()
method of the activity, I change the value of InArgument
parameter - I want the variable value to change too. How can I do it?
My code is like this...
...
public InArgument<string> AcceptedForms{ get; set; }
...
protected override void Execute(CodeActivityContext context)
{
...
string AForms= "#AcceptedForms_"+ this.Id;
AcceptedForms.Set(context, AForms);
...
}
I can use the value of AcceptedForms
in this method after changing it's value. But it doesn't pass to the variable that I assign to it in Activity Library Designer. I want to use it's value in another Activity.
发布评论
评论(1)
您将无法执行此操作,因为当它们传递到 WF 运行时时我不认为它们是通过引用传递的。因此,您需要做的是设置您在 Execute 方法中设置的 OutArgument,并将该 OutArgument(在工作流程中)设置为变量。
更新
如果您能花 15 分钟观看此视频 我想你会更好地理解发生了什么。顺便说一句,下面是本系列视频的完整列表,它是此类事物的惊人基础。
You won't be able to do that because when they are passed into the WF runtime I don't think they are passed by reference. So, what you'll have to do is setup an OutArgument that you set while in the Execute method and set that OutArgument -- in the workflow -- to the variable.
UPDATE
If you can take 15 minutes and watch this video I think you'll better understand what's going on. And BTW, below is the entire list of videos in this series, it's an amazing foundation on these types of things.