Skip to content

Commit f9089e2

Browse files
committed
2 parents 1800994 + f1eb45b commit f9089e2

1 file changed

Lines changed: 39 additions & 107 deletions

File tree

README.md

Lines changed: 39 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
1-
[![NuGet Downloads](https://img.shields.io/nuget/dt/SimpleStateMachineLibrary)](https://www.nuget.org/packages/SimpleStateMachineLibrary)
2-
[![NuGet Pre Release](https://img.shields.io/nuget/vpre/SimpleStateMachineLibrary.svg)](https://www.nuget.org/packages/SimpleStateMachineLibrary)
3-
[![](https://img.shields.io/github/stars/SimpleStateMachine/SimpleStateMachineLibrary)](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary)
4-
[![](https://img.shields.io/github/license/SimpleStateMachine/SimpleStateMachineLibrary)](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary)
5-
# SimpleStateMachineLibrary
1+
2+
[![NuGet Pre Release](https://img.shields.io/nuget/vpre/SimpleStateMachineLibrary.svg)](https://www.nuget.org/packages/SimpleStateMachineLibrary) [![](https://img.shields.io/github/stars/SimpleStateMachine/SimpleStateMachineLibrary)](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary) [![NuGet Downloads](https://img.shields.io/nuget/dt/SimpleStateMachineLibrary)](https://www.nuget.org/packages/SimpleStateMachineLibrary) [![](https://img.shields.io/github/license/SimpleStateMachine/SimpleStateMachineLibrary)](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary) [![](https://img.shields.io/github/languages/code-size/SimpleStateMachine/SimpleStateMachineLibrary)](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary)
3+
[![]( https://img.shields.io/github/last-commit/SimpleStateMachine/SimpleStateMachineLibrary)](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary) [![](https://img.shields.io/badge/chat-slack-blueviolet.svg)](https://join.slack.com/t/simplestatemachine/shared_invite/zt-fnfhvvsx-fTejcpPn~PPb2ojdG_MQBg) [![](https://img.shields.io/badge/chat-telegram-blue.svg)](https://t.me/joinchat/HMLJFkv9do6aDV188rhd0w)
4+
# SimpleStateMachineLibrary
65
A C# library for realization simple state-machine on .Net
7-
# Why SimpleStateMachine?
8-
Create state machine in **two steps** :
9-
1. Create scheme in [node editor](https://github.com/SimpleStateMachine/SimpleStateMachineNodeEditor) ♦️
10-
2. Load scheme in your project using [library](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary)📑
11-
12-
Just describe your app logic and run the state machine🚀
13-
14-
## Give a Star! :star:
6+
7+
## Give a Star! :star:
158
If you like or are using this project please give it a star. Thanks!
16-
## Сontent
17-
1. [Features](#Features)
18-
2. [Examples](#Examples)
19-
4. [Documentation](#Documentation)
20-
4. [License](#License)
219

22-
## Features
10+
# Why SimpleStateMachine?
11+
Create state machine in **three** steps :
12+
13+
**1.** Create scheme in [node editor🔗](https://github.com/SimpleStateMachine/SimpleStateMachineNodeEditor) and load it in your project using [this library📚](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary)
14+
```C#
15+
StateMachine stateMachine = new StateMachine("scheme.xml");
16+
```
17+
**2.** Describe your app logic on events⚡
18+
```C#
19+
stateMachine.GetState("State1").OnExit(Action1);
20+
stateMachine.GetState("State2").OnEntry(Action2);
21+
stateMachine.GetTransition("Transition1").OnInvoke(Action3);
22+
stateMachine.OnChangeState(Action4);
23+
```
24+
**3.** Run the state machine🚘
25+
```C#
26+
stateMachine.Start();
27+
```
28+
## Features💡
2329

2430
State machine properties:
2531
* Start state
@@ -35,97 +41,23 @@ Useful extensions for work:
3541
* Export/Import to/from XML
3642
* Logging
3743

38-
39-
## Examples:
40-
41-
### Structure ###
42-
```C#
43-
StateMachine stateMachine = new StateMachine();
44-
45-
//Add states
46-
State state1 = stateMachine.AddState("State1");
47-
State state2 = stateMachine.AddState("State2");
48-
State state3 = stateMachine.AddState("State3");
49-
State state4 = stateMachine.AddState("State4");
50-
51-
//Add transitions three ways:
52-
53-
//Standart way
54-
Transition transition1 = stateMachine.AddTransition("Transition1", state1, state2);
55-
56-
//From state
57-
Transition transition2 = state2.AddTransitionFromThis("Transition2", state3);
58-
59-
//To state
60-
Transition transition3 = state4.AddTransitionToThis("Transition3", state3);
61-
62-
//Add action on entry or/and exit
63-
state1.OnExit(Action1);
64-
state2.OnEntry(Action2);
65-
state3.OnExit(Action3);
66-
state4.OnExit(Action4);
67-
68-
//Set start state
69-
state1.SetAsStartState();
70-
71-
//Start work
72-
stateMachine.Start();
73-
```
74-
### Actions Syntax ###
75-
##### Action on entry/exit #####
76-
```C#
77-
void ActionOnEtnry(State state, Dictionary<string, object> parameters)
78-
{
79-
//you need invoke transition in entry or exit action, differently work state machine will be end
80-
state.StateMachine.InvokeTransition("Transition1");
81-
}
82-
44+
## Getting Started📂
45+
Install from Nuget:
46+
```sh
47+
Install-Package SimpleStateMachineLibrary
8348
```
84-
##### Action on change state #####
85-
```C#
86-
void ActionOnChangeState(State stateFrom, State stateTo)
87-
{
49+
## Documentation📄
50+
Documentation here: https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki
8851

89-
}
90-
```
91-
##### Action on transition invoke #####
92-
```C#
93-
void ActionOnTransitionInvoke(Transition transition, Dictionary<string, object> parameters)
94-
{
52+
## FAQ❔
53+
If you think you have found a bug, create a github [issue](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/issues).
54+
55+
But if you just have questions about how to use:
56+
57+
- [Slack channel](https://join.slack.com/t/simplestatemachine/shared_invite/zt-fnfhvvsx-fTejcpPn~PPb2ojdG_MQBg)
58+
- [Telegram channel](https://t.me/joinchat/HMLJFkv9do6aDV188rhd0w)
9559

96-
}
97-
```
98-
## Documentation
99-
* StateMachine
100-
* [Create](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/StateMachine#Create)
101-
* [Import](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/StateMachine#Import)
102-
* [Export](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/StateMachine#Export)
103-
* [Logging](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/StateMachine#Logging)
104-
* [OnChangeState](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/StateMachine#OnChangeState)
105-
* [CurrentState](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/StateMachine#CurrentState)
106-
* [PreviousState](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/StateMachine#PreviousState)
107-
* [CurrentTransition](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/StateMachine#CurrentTransition)
108-
* State
109-
* [Create](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/State#Create)
110-
* [Get](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/State#Get)
111-
* [Exists](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/State#Exists)
112-
* [Delete](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/State#Delete)
113-
* [Entry](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/State#Entry)
114-
* [Exit](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/State#Exit)
115-
* Transition
116-
* [Create](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/Transition#Create)
117-
* [Get](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/Transition#Get)
118-
* [Exists](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/Transition#Exists)
119-
* [Delete](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/Transition#Delete)
120-
* [Invoke](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/Transition#Invoke)
121-
* [Parameters](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/Transition#Parameters)
122-
* Data
123-
* [Create](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/Data#Create)
124-
* [Get](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/Data#Get)
125-
* [Exists](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/Data#Exists)
126-
* [Delete](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/Data#Delete)
127-
* [Change](https://github.com/SimpleStateMachine/SimpleStateMachineLibrary/wiki/Data#Change)
128-
## License
60+
## License📑
12961

13062
Copyright (c) SimpleStateMachine
13163

0 commit comments

Comments
 (0)