Skip to content

Commit

Permalink
Readme edited
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackMali committed Dec 7, 2023
1 parent 7d0c304 commit 484fd02
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ State machine implementation in C#.
|.NET Framework | `.net 4.6.x` `.net 4.7.x` `.net 4.8.x` |
|.NET Standard | `.net standard 2.x` |
|.NET Core | `.net Core app 2.x` `.net core app 3.x` |
|.NET | `.net 5` `.net 6` `.net 7` |
|.NET | `.net 5` `.net 6` `.net 7` `.net 8` |

## NuGet

Expand All @@ -41,6 +41,7 @@ Or via the .NET Core command line interface:
```csharp
var builder = new ContainerBuilder();
builder.RegisterModule<StateMachineModule>();
builder.RegisterType<LockState>().AsSelf();
```

## Configuration
Expand All @@ -52,14 +53,14 @@ public class SlotMachine

public SlotMachine(IStateMachineBuilder builder)
{
// With registration -> AddState<LockState>()
// With DI registration -> AddState<LockState>()
builder.AddState<LockState>()
.AddStartTransition();
.AddInStateTransition()
.AddTransition<UnLockState>()
.AddTransition<EndState>();

// Without registration -> AddState(new UnLockState())
// Without DI registration -> AddState(new UnLockState())
builder.AddState(new UnLockState())
.AddInStateTransition()
.AddTransition<LockState>()
Expand All @@ -76,14 +77,14 @@ public class SlotMachine
```csharp

// Perform state change
await machine.Transmit<LockState>();
await _stateMachine.Transmit<LockState>();

// Or with Event
await machine.Transmit<LockState>(new StateMachineEvent());
await _stateMachine.Transmit<LockState>(new StateMachineEvent());

// Or safe with exception handling
machine.OnError += (sender, args) => { };
await machine.TryTransmit<LockState>(new StateMachineEvent());
await _stateMachine.TryTransmit<LockState>(new StateMachineEvent());

```

Expand All @@ -92,10 +93,10 @@ await machine.TryTransmit<LockState>(new StateMachineEvent());
```csharp

// Posts an event to the current status
await machine.Post(new StateMachineEvent());
await _stateMachine.Post(new StateMachineEvent());

// Safe posting
await machine.TryPost(new StateMachineEvent());
await _stateMachine.TryPost(new StateMachineEvent());

```

Expand Down

0 comments on commit 484fd02

Please sign in to comment.