public void UpdateState() { int result = _xInput.GetState(_playerIndex, ref gamepadStateCurrent); IsConnected = (result == 0); UpdateBatteryState(); if (gamepadStateCurrent.PacketNumber != gamepadStatePrev.PacketNumber) { OnStateChanged(); } gamepadStatePrev.Copy(gamepadStateCurrent); if (_stopMotorTimerActive && (DateTime.Now >= _stopMotorTime)) { XInputVibration stopStrength = new XInputVibration() { LeftMotorSpeed = 0, RightMotorSpeed = 0 }; _xInput.SetState(_playerIndex, ref stopStrength); } }