如何在重新托管的 Workflow 4 Designer 中自定义活动?
此文章展示了如何在重新托管的工作流设计器中创建自定义活动(与工作流基础 4)。在该示例中,通过实现 IActivityTemplateFactory
接口并为 Delay
输入指定默认值来创建 MyDelayActivity
。
但是,是否也可以修改活动的输入? 例如,假设我想添加一个新的 StartProcess
活动,它接受一个字符串并运行该字符串指定的进程。我可以通过添加 InvokeMethod
活动,指定 Process.Start
作为方法并指定包含字符串作为参数的 Collection,使用本机活动来实现此功能。
我可以通过仅包含字符串输入的 StartProcess
框来简化所有这些吗?
This article shows how to create a custom activity in a rehosted Workflow designer (with Workflow Foundation 4). In that example, a MyDelayActivity
is created by implementing the IActivityTemplateFactory
interface, and specifying the default value to the Delay
inputs.
However, is it possible to modify the inputs of the activity as well?
For example, let's say I want to add a new StartProcess
activity which takes a string and run the process specified by the string. I can implement this with the native activities by adding a InvokeMethod
activity, specifying Process.Start
as the method and a Collection containing the string as the parameter.
Can I simplify all these by just having a StartProcess
box with only a string input?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当然,只需创建活动来完成工作并添加 InArgument 属性来提供您需要的数据。当您将活动拖放到设计图面上时,您可以使用属性表来设置参数。或者,您可以创建一个活动设计器来在设计界面上执行相同的操作,例如 WriteLine 活动。
例子:
Sure, just create the activity to do the work and add InArgument properties to provide the data you need. When you drop the activity on the design surface you can use the property sheet to set the arguments. Alternatively you can create an activity designer to do the same on the design surface like for example the WriteLine activity.
Example:
其他信息,MSDN 网站上有两个非常有用的视频教程: 开发自定义活动< /a> 和活动设计者,我认为演讲者是同一个莫里斯作为接受的回答者:)
Additional information, there are two very helpful video tutorials in the MSDN website: Developing custom activities and Activity designers, and I assume the speaker is the same Maurice as the accepted answerer :)