File tree Expand file tree Collapse file tree 2 files changed +8
-11
lines changed
Examples/Example.ConsoleApp Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -14,22 +14,19 @@ public static void Run()
14
14
. OnEnter ( x => Console . WriteLine ( $ "State change to { x . State } from { x . PrevState } ") )
15
15
16
16
. State ( States . S1 )
17
- . On < Event1 , string > ( ) . Execute ( x => { /* some operations */ return $ "{ x . Data . SomeProp } results"; } )
17
+ . On < Event1 , string > ( ) . Execute ( x => $ "{ x . Data . SomeProp } results")
18
18
. On < Event2 > ( ) . JumpTo ( States . S2 )
19
19
20
20
. State ( States . S2 )
21
- . On < Event3 > ( ) . Enable ( x => /* some conditions */ true ) . JumpTo ( States . S3 )
21
+ . On < Event3 > ( ) . JumpTo ( States . S3 )
22
22
23
23
. State ( States . S3 )
24
24
. OnEnter ( x => Console . WriteLine ( $ "Enter to final state") )
25
25
26
26
. Build ( ) ;
27
27
28
28
29
- Console . WriteLine ( fsm . Trigger ( new Event1
30
- {
31
- SomeProp = "example"
32
- } ) ) ;
29
+ Console . WriteLine ( fsm . Trigger ( new Event1 { SomeProp = 123 } ) ) ;
33
30
34
31
fsm . Trigger ( new Event2 ( ) ) ;
35
32
@@ -41,7 +38,7 @@ public static void Run()
41
38
42
39
class Event1 : IFsmEvent < string >
43
40
{
44
- public string ? SomeProp { get ; set ; }
41
+ public int SomeProp { get ; set ; }
45
42
}
46
43
47
44
class Event2 : IFsmEvent < object > ;
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ fsm.Trigger(Event.E3);
38
38
``` C#
39
39
class Event1 : IFsmEvent <string >
40
40
{
41
- public string ? SomeProp { get ; set ; }
41
+ public int SomeProp { get ; set ; }
42
42
}
43
43
44
44
class Event2 : IFsmEvent <object >;
@@ -48,10 +48,10 @@ class Event3 : IFsmEvent<object>;
48
48
var fsm = new FsmBuilder <States , Type >(States .S1 )
49
49
.OnEnter (x => Console .WriteLine ($" State change to {x .State } from {x .PrevState }" ))
50
50
.State (States .S1 )
51
- .On <Event1 , string >().Execute (x => { /* some operations */ return $" {x .Data .SomeProp } results" ; } )
51
+ .On <Event1 , string >().Execute (x => $" {x .Data .SomeProp } results" )
52
52
.On <Event2 >().JumpTo (States .S2 )
53
53
.State (States .S2 )
54
- .On <Event3 >().Enable ( x => /* some conditions */ true ). JumpTo (States .S3 )
54
+ .On <Event3 >().JumpTo (States .S3 )
55
55
.State (States .S3 )
56
56
.OnEnter (x => Console .WriteLine ($" Enter to final state" ))
57
57
.Build ();
@@ -67,7 +67,7 @@ fsm.Trigger(new Event3());
67
67
68
68
69
69
// Console output:
70
- // example results
70
+ // 123 results
71
71
// State change to S2 from S1
72
72
// State change to S3 from S2
73
73
// Enter to final state
You can’t perform that action at this time.
0 commit comments