Available transitions

Oct 11, 2010 at 1:49 PM


Is there a way to know which are the available transitions from a state?
I'm defining a state machine that controls the flow of a console applications, and I should show different commands according to the available operations (I would like to define a sort of Wizard).


Thank you 

Oct 13, 2010 at 8:11 PM
        public List<Transition> GetTransitionsFromState(string stateDisplayName)
            IEnumerable<Activity> activitiesInWorkflow = WorkflowInspectionServices.GetActivities(new {The name of the workflow with the statemachine}());
List<Transition> transitionsFromState = new List<Transition>(); foreach (var activity in activitiesInWorkflow) { if (activity is StateMachine) { StateMachine stateMachine = activity as StateMachine; IList<State> states = stateMachine.States; foreach (var state in states) { if (state.DisplayName == stateDisplayName) { transitionsFromState = state.Transitions.ToList(); break; } } break; }//if } return transitionsFromState; }
Oct 17, 2010 at 7:18 AM

Thank you very much