从工作流活动发布事件
我正在使用 prism 构建 WPF 应用程序,并且我想使用工作流基础(本地和来自服务)。
是否有人了解如何构建使用 EventAggretator 调用的工作流活动,然后让工作流发布事件作为响应?我正在考虑构建一个允许活动发布一对多事件的实现,这对于工作流来说是一个好的场景吗?
I'm building a WPF application using prism and I'd like to use workflow foundation (both locally and from a service).
Does anyone have insight on building workflow activities invoked using the EventAggretator and then have workflow publish events in response? I'm considering building an implementation that would allow an activity to publish one to many events, is this a good scenario for workflow?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用事件聚合器实现的一种方法是要求它作为工作流活动的扩展,如下所示。然后,您可以在 WorkflowApplication / WorkflowInvoker 中注册事件聚合器的实例,以便您的活动可以引发事件。我还没有在我的应用程序中使用事件聚合器,所以可能会有一些怪癖。
自定义活动需要事件聚合器并在其执行方法中使用它:
注册事件聚合器实例以在您的活动中使用:
希望有所帮助。
编辑:我发现这个视频显示了构建事件驱动+长期运行的工作流程,这可能也有一些帮助。不过我还没看过: http://channel9.msdn.com/事件/构建/BUILD2011/TOOL-801T
One way you can implement using an event aggregator is to require it as an extension to your workflow activities like the following. In your WorkflowApplication / WorkflowInvoker, you can then register an instance of the event aggregator so that your activities can raise the events. I haven't used the event aggregator (yet) in my apps, so there might be some quirks.
Custom Activity that requires an event aggregator and uses it in its Execute method:
Registering the event aggregator instance for use in your activities:
Hope that helps.
EDIT: I found this video that shows building an event driven +long running workflow that might be of some help as well. I haven't watched it yet though: http://channel9.msdn.com/Events/Build/BUILD2011/TOOL-801T