是否可以在状态之间转换,直到 wf 中发生多个事件?
我正在 Visual Studio 2008 中使用 C# 和 WF 开发状态机工作流。在其中一个状态下,我需要等待多个事件发生,直到工作流可以转换到下一个状态。 举个例子,想象一下一致投票的场景。 我找不到办法做到这一点。 有人对这个问题有解决方案或解决方法吗?
I am developing a State Machine Workflow using C# and WF in visual studio 2008. On one of my states I need to wait for multiple events to happen until the workflow can transition to the next state. As an example think of a unanimous voting scenario. I cannot find a way to do this. Does anyone have a solution or workaround for this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一个更优雅的解决方案是使用 ParallelActivity:
http://spellcoder.com/blogs/bashmohandes/archive/ 2006/10/02/690.aspx
A much more elegant solution would be to use the ParallelActivity:
http://spellcoder.com/blogs/bashmohandes/archive/2006/10/02/690.aspx
您可以在一个状态内拥有多个事件驱动的活动,因此您可以为每个事件设置处理程序,然后设置本地布尔值来跟踪哪个事件已成功执行。 每次之后,您可以检查这些值并确定是否需要进行状态更改。
You can have multiple event driven activities within a state, so you could have handlers for each of the events you have and then set local booleans to track which has been executed successfully. After each, you could check the values and determine if you need to make a state change.