public Joystick() { var di = new DirectInput(); foreach (var device in di.GetDevices(DeviceClass.GameController, DeviceEnumerationFlags.AttachedOnly)) { try { joystick = new SlimDX.DirectInput.Joystick(di, device.InstanceGuid); Connected = true; joystick.RunControlPanel(); break; } catch { } } /*foreach (DeviceObjectInstance deviceObject in joystick.GetObjects()) { if ((deviceObject.ObjectType & ObjectDeviceType.Axis) != 0) { joystick.GetObjectPropertiesById((int)deviceObject.ObjectType).SetRange(-1000, 1000); } }*/ if (Connected) joystick.Acquire(); }