本文整理汇总了C#中StateMachine.Asynchronous方法的典型用法代码示例。如果您正苦于以下问题:C# StateMachine.Asynchronous方法的具体用法?C# StateMachine.Asynchronous怎么用?C# StateMachine.Asynchronous使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StateMachine
的用法示例。
在下文中一共展示了StateMachine.Asynchronous方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Sample
public Sample()
{
InitializeComponent();
stateMachineBuilder = new StateMachineBuilder();
stateMachineBuilder.AddState(States.Green)
.TransitionOn(Events.Change, States.Yellow)
.OnEnter(s => Invoker(() => pnlGreen.BackColor = GreenOn))
.OnExit(s => Invoker(() => pnlGreen.BackColor = GreenOff))
.Timeout(3000, States.Yellow)
.InitialState();
stateMachineBuilder.AddState(States.Yellow)
.TransitionOn(Events.Change, States.Red)
.Timeout(3000, States.Red)
.OnEnter(s => Invoker(() => pnlYellow.BackColor = YellowOn))
.OnExit(s => Invoker(() => pnlYellow.BackColor = YellowOff));
stateMachineBuilder.AddState(States.Red)
.TransitionOn(Events.Change, States.Green)
.Timeout(3000, States.Green)
.OnEnter(s => Invoker(() => pnlRed.BackColor = RedOn))
.OnExit(s => Invoker(() => pnlRed.BackColor = RedOff));
stateMachine = new StateMachine("StopLight", stateMachineBuilder);
stateMachine.Asynchronous();
}