How to get current state from bbv.Common.StateMachine (now Appccelerate.StateMachine) class?
- 阅读更多 关于 How to get current state from bbv.Common.StateMachine (now Appccelerate.StateMachine) class?
问题 bbv.Common.StateMachine class is the best state machine code I have ever seen. But it lacks just one thing: getting current state. This is an order tracking system: fsm = new ActiveStateMachine<States, Events>(); fsm.In(States.OrderCreated) .On(Events.Submitted) .Goto(States.WaitingForApproval); fsm.In(States.WaitingForApproval) .On(Events.Reject) .Goto(States.Rejected); fsm.In(States.WaitingForApproval) .On(Events.Approve) .Goto(States.BeingProcessed); fsm.In(States.BeingProcessed) .On