Movensys.FSMHelper.Core 1.0.5

dotnet add package Movensys.FSMHelper.Core --version 1.0.5
                    
NuGet\Install-Package Movensys.FSMHelper.Core -Version 1.0.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Movensys.FSMHelper.Core" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Movensys.FSMHelper.Core" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="Movensys.FSMHelper.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Movensys.FSMHelper.Core --version 1.0.5
                    
#r "nuget: Movensys.FSMHelper.Core, 1.0.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Movensys.FSMHelper.Core@1.0.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Movensys.FSMHelper.Core&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=Movensys.FSMHelper.Core&version=1.0.5
                    
Install as a Cake Tool

Movensys.FSMHelper

This is a generic enum-based finite state machine (FSM) developed by the Movensys Application Team.

Features

  • Easy to use based on enum
  • State Management
  • State Transition
  • State Query
  • Timeout Management
  • Events

Code Highlighting

using Movensys.FSMHelper;

namespace WinFormsApp1
{
    public enum DeviceState
 {
     Idle,
     Running,
     Error,
     Stopped
 }

 var fsm = new Fsm<DeviceState>(DeviceState.Idle);

 fsm.Set(DeviceState.Running);

 var currentState = fsm.Get();

 if (fsm.IsTimeout(5000))
 {
    Console.WriteLine("Timeout");
 }

 fsm.SetCheckEvent += (sender, e) =>
 {
    Console.WriteLine($"State : {e.previousCmd} -> {e.currentCmd}");
 };
}

Tip

  • Set() already calls ResetTimeout() internally, so the timeout always measures the time since the last transition, not since the FSM started. Calling ResetTimeout() right before or after Set() is redundant.
  • Set() returns false when the new state equals the current state. No transition occurs and SetCheckEvent is not raised.
  • After a reset, the first IsTimeout() call only starts the measurement and always returns false. Elapsed time is therefore counted from that first call, not from the transition itself.
  • IsTimeout() restarts its internal timer when it returns true, so the result is not latched. Be careful with if (IsTimeout(3000) && cond) - when cond is false the timeout is still consumed and the next one takes another 3000 ms.
  • There are no transition rules. Any state can move to any other state, and illegal transitions are not detected. Validate them on the caller side if required.
  • This class is not thread-safe. Drive it from a single thread, or synchronize on the caller side.

Release History

Jul 16, 2026 - 1.0.5 ver<br> The initial state passed to the Fsm constructor is now applied to the current state. It was previously ignored, so Get() returned the default enum value (0) until the first Set() call.

May 20, 2025 - 1.0.4 ver<br> A message field has been added to the SetCheckEventArgs event class. The default value is an empty string ("").

May 2, 2025 - 1.0.3 ver<br> Only the Function function is separated from the existing FSMHelper 1.0.2 (for cross-platform)

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Framework net45 is compatible.  net451 is compatible.  net452 is compatible.  net46 is compatible.  net461 is compatible.  net462 is compatible.  net463 was computed.  net47 is compatible.  net471 is compatible.  net472 is compatible.  net48 is compatible.  net481 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.5

    • No dependencies.
  • .NETFramework 4.5.1

    • No dependencies.
  • .NETFramework 4.5.2

    • No dependencies.
  • .NETFramework 4.6

    • No dependencies.
  • .NETFramework 4.6.1

    • No dependencies.
  • .NETFramework 4.6.2

    • No dependencies.
  • .NETFramework 4.7

    • No dependencies.
  • .NETFramework 4.7.1

    • No dependencies.
  • .NETFramework 4.7.2

    • No dependencies.
  • .NETFramework 4.8

    • No dependencies.
  • .NETFramework 4.8.1

    • No dependencies.
  • net5.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.5 0 11/23/2026
1.0.4 331 5/20/2025
1.0.3 232 5/2/2025