使用分配给 InArgument<> 的变量

发布于 2025-01-08 05:11:49 字数 653 浏览 3 评论 0 原文

我想在我的 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

若水微香 2025-01-15 05:11:49

您将无法执行此操作,因为当它们传递到 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文