GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - codingseb/SimpleStateMachineLibrary: A simple library for realization state machines in C# code

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

66 Commits
66 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
Examples
Examples
 
 
SimpleStateMachineLibrary
SimpleStateMachineLibrary
 
 
Tests
Tests
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
CodeMap1.dgml
CodeMap1.dgml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
SimpleStateMachineLibrary.sln
SimpleStateMachineLibrary.sln
 
 

Repository files navigation

NuGet Pre Release

SimpleStateMachineLibrary

A C# library for realization simple state-machine on .Net

Why SimpleStateMachine?

Create state machine in two steps :

  1. Create scheme in node editor ♦️
  2. Load scheme in your project using library📑

Just describe your app logic and run the state machine🚀

Give a Star! ⭐

If you like or are using this project please give it a star. Thanks!

Сontent

  1. Features
  2. Examples
  3. Documentation
  4. License

Features

State machine properties:

  • Start state
  • Entry/exit events for state
  • Invoke event for transition
  • Parameters for transitions
  • Parameters for entry/exit for state

Useful extensions for work:

  • State changed event for state machine
  • Data for sharing between states
  • Change event for data
  • Export/Import to/from XML
  • Logging

Examples:

Structure

            StateMachine stateMachine = new StateMachine();

            //Add states
            State state1 = stateMachine.AddState("State1");
            State state2 = stateMachine.AddState("State2");
            State state3 = stateMachine.AddState("State3");
            State state4 = stateMachine.AddState("State4");

            //Add transitions three ways:

            //Standart way
            Transition transition1 = stateMachine.AddTransition("Transition1", state1, state2);

            //From state
            Transition transition2 = state2.AddTransitionFromThis("Transition2", state3);

            //To state
            Transition transition3 = state4.AddTransitionToThis("Transition3", state3);
          
            //Add action on entry or/and exit
            state1.OnExit(Action1);
            state2.OnEntry(Action2);
            state3.OnExit(Action3);
            state4.OnExit(Action4);

            //Set start state
            state1.SetAsStartState();

            //Start work
            stateMachine.Start();

Actions Syntax

Action on entry/exit
        void ActionOnEtnry(State state, Dictionary<string, object> parameters)
        {
            //you need invoke transition in entry or exit action, differently work state machine will be end
            state.StateMachine.InvokeTransition("Transition1");
        }
Action on change state
        void ActionOnChangeState(State stateFrom, State stateTo)
        {

        }
Action on transition invoke
        void ActionOnTransitionInvoke(Transition transition, Dictionary<string, object> parameters)
        {

        }

Documentation

  • StateMachine
    • Create
    • Import
    • Export
    • Logging
  • State
    • Create
    • Get
    • Exists
    • Delete
    • Entry
    • Exit
  • Transition
    • Create
    • Get
    • Exists
    • Delete
    • Invoke
    • Parameters
  • Data
    • Create
    • Get
    • Exists
    • Delete
    • Change

License

Copyright (c) SimpleStateMachine

Licensed under the MIT license.

About

A simple library for realization state machines in C# code

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.