public void SetLight(FaderPortButton button, FaderPortLightState state) { lock (_lightState) { if (state == FaderPortLightState.Toggle) { var oldState = _lightState[button]; // Everything except a current setting of Off results in a new state of Off state = oldState == FaderPortLightState.Off ? FaderPortLightState.On : FaderPortLightState.Off; } _lightState[button] = state; } SetLight(button, state != FaderPortLightState.Off); }
public ButtonMessage(FaderPortButton button, bool pressed, FaderPortLightState light) { Button = button; Pressed = pressed; Light = light; }