public HueLightButton(IGameBox gameBox, IHueClient hueClient, Light light, ILightableButton lightableButton) { this.gameBox = gameBox; this.hueClient = hueClient; this.light = light; this.lightableButton = lightableButton; }
public HueStateMachine(IBox gameBox, LocatedBridge bridge, ILightableButton button, List <ILightableButton> playerTwoButtons, CancellationToken cancellationToken) { this.gameBox = gameBox; this.bridge = bridge; this.button = button; this.playerTwoButtons = playerTwoButtons; this.cancellationToken = cancellationToken; this.stateMachine = new StateMachine <HueBridgeState, HueBridgeEvent>(); this.stateMachine.In(HueBridgeState.Initialized) .On(HueBridgeEvent.Located) .Goto(HueBridgeState.Located); this.stateMachine.In(HueBridgeState.Located) .ExecuteOnEntry(this.Located) .On(HueBridgeEvent.Connected) .Goto(HueBridgeState.Connected) .On(HueBridgeEvent.Register) .Goto(HueBridgeState.Register); this.stateMachine.In(HueBridgeState.Register) .ExecuteOnEntry(this.Register) .On(HueBridgeEvent.Connected) .Goto(HueBridgeState.Connected); this.stateMachine.In(HueBridgeState.Connected) .ExecuteOnEntry(this.Connected) .On(HueBridgeEvent.Select) .Goto(HueBridgeState.Selected); this.stateMachine.In(HueBridgeState.Selected) .ExecuteOnEntry(this.Selected) .On(HueBridgeEvent.Unselect) .Goto(HueBridgeState.Connected) .Execute(this.Unselect); this.stateMachine.TransitionExceptionThrown += this.StateMachineOnTransitionExceptionThrown; this.stateMachine.Initialize(HueBridgeState.Initialized); }
private async void LightifyOnPress(ILightableButton lbpp, ButtonPressedEventArgs args) { await lbpp.SetLight(args.IsPressed); }