completion transitions, triggerless transitions

108 views
Skip to first unread message

Steven T. Cramer

unread,
May 9, 2014, 1:11:22 PM5/9/14
to dotnet-state-ma...@googlegroups.com
I am new to stateless.  I would like transitions without a trigger to automatically fire.  

I currently put 
StateMachine.Fire(Trigger.Implicit);

at the end of an OnEntry method or in one case 

StateMachine.Configure(State.Choice)
        .OnEntry(() => StateMachine.Fire(Trigger.Implicit))

Is there some easy way to have this fire on all states on state completion?

Grant BlahaErath

unread,
May 14, 2014, 6:54:45 AM5/14/14
to dotnet-state-ma...@googlegroups.com

It has been a while since I used stateless but you don't want to fire inside an OnEntry.  It may not look like it but in reality it's recursion since the Fire that got you there never exits until all the event handlers like OnEnter are called.

Wrap the state machine in a while loop that calls Fire.  That way the Fire call gets to exit before it is issued again. 

--

---
You received this message because you are subscribed to the Google Groups "Stateless .NET State Machine Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotnet-state-machine-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages