dotnet-state-machine / stateless

A simple library for creating state machines in C# code
Other
5.53k stars 765 forks source link

New example: Alarm #517

Closed celloza closed 1 year ago

celloza commented 1 year ago

Always wanted to build an alarm system as a state machine. Project I'm working on (alarm system for a yacht) required me to do it, so I put together an example using Stateless.

I needed support for "temporary" states (i.e. PreArmed, a state between Disarmed and Armed (to allow for some configurable pre-arm delay)), which I've implemented using timers triggered via OnEntry() and OnExit() methods. These temporary states have a pre-defined TimeOut transition/command that progresses/regresses them to the relevant state.

PR #516 raised.

HenningNT commented 1 year ago

Well done, thank you for your contribution!