Skip to content

Commit 2415432

Browse files
committed
2 parents 6b9e440 + 9d43c7b commit 2415432

File tree

2 files changed

+30
-18
lines changed

2 files changed

+30
-18
lines changed

.github/FUNDING.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
custom: ['paypal.me/romansolovyov']

README.md

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# SimpleStateMachineLibrary
1+
# SimpleStateMachineLibrary [![NuGet Pre Release](https://img.shields.io/nuget/vpre/SimpleStateMachineLibrary.svg)](https://www.nuget.org/packages/SimpleStateMachineLibrary)
22
A C# library for realization simple state-machine on .Net
33

44
## Сontent
55
1. [Features](#Features)
66
2. [Examples](#Examples)
7+
3. [License](#License)
78

89
## Features
910

@@ -24,7 +25,7 @@ Useful extensions for work:
2425

2526
## Examples:
2627

27-
**Structure**
28+
### Structure ###
2829
```C#
2930
StateMachine stateMachine = new StateMachine();
3031

@@ -46,36 +47,44 @@ Useful extensions for work:
4647
Transition transition3 = state4.AddTransitionToThis("Transition3", state3);
4748

4849
//Add action on entry or/and exit
49-
state1.OnExit(Method1);
50-
state2.OnEntry(Method2);
51-
state3.OnExit(Method3);
52-
state4.OnExit(Method4);
50+
state1.OnExit(Action1);
51+
state2.OnEntry(Action2);
52+
state3.OnExit(Action3);
53+
state4.OnExit(Action4);
5354

5455
//Set start state
5556
state1.SetAsStartState();
5657

5758
//Start work
5859
stateMachine.Start();
5960
```
60-
**Example methods**
61+
### Actions Syntax ###
62+
##### Action on entry/exit #####
6163
```C#
62-
static void Method1(State state, Dictionary<string, object> parameters)
64+
void ActionOnEtnry(State state, Dictionary<string, object> parameters)
6365
{
66+
//you need invoke transition in entry or exit action, differently work state machine will be end
6467
state.StateMachine.InvokeTransition("Transition1");
6568
}
66-
67-
static void Method2(State state, Dictionary<string, object> parameters)
68-
{
69-
state.StateMachine.InvokeTransition("Transition2");
70-
}
71-
72-
static void Method3(State state, Dictionary<string, object> parameters)
69+
70+
```
71+
##### Action on change state #####
72+
```C#
73+
void ActionOnChangeState(State stateFrom, State stateTo)
7374
{
74-
state.StateMachine.InvokeTransition("Transition3");
75+
7576
}
76-
77-
static void Method4(State state, Dictionary<string, object> parameters)
77+
```
78+
##### Action on transition invoke #####
79+
```C#
80+
void ActionOnTransitionInvoke(Transition transition, Dictionary<string, object> parameters)
7881
{
7982

8083
}
8184
```
85+
## License
86+
87+
Copyright (c) SimpleStateMachine
88+
89+
Licensed under the [MIT](LICENSE) license.
90+

0 commit comments

Comments
 (0)