You need to set
InitialState[
^] to the particular state that should start off the processing. You could set it before you call
WorkflowInvker.Invoke(SMwf);
like this:
StateMachine sm = (StateMachine)SMwf;
sm.InitialState = sm.States[0];
Better still, don't do the cast - create SMwf as a
StateMachine
instead of an
Activity
.