Enumerate possible states transition of Workflow Foundation state machine
-
18-09-2019 - |
Question
For GUI purposes I need by current state of state machine to enumerate possible available states of transition. For example there is transitions: A->B, A->C, B->D, C->D. Assuming state machine is in A state, so I need get list of B and C.
Solution
I've found my own answer, right now it looks as stupid question. So, it is enough to create lightweight object StateMachineWorkflowInstance around my instance of Workflow, here the code:
StateMachineWorkflowInstance smw =
new StateMachineWorkflowInstance(MyWorkflowRuntime, A);
return smw.PossibleStateTransitions.ToArray();
OTHER TIPS
In .NET 4.0, the WorkflowApplication.Idle
event contains WorkflowApplicationIdleEventArgs
, which contains a Bookmarks
property.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow