示例#1
0
        public void AddGlobalDevices()
        {
            int deviceIndex = 0;

            while (true)
            {
                GlobalJoystickInputSource joystick = new GlobalJoystickInputSource(deviceIndex);
                joystick.UpdateState();
                if (!joystick.IsAvailable)
                {
                    break;
                }

                this.AddSource(joystick);
                deviceIndex++;
            }
        }
        public void AddGlobalDevices()
        {
            const int MinDeviceCheckCount = 8;
            int       deviceIndex         = 0;

            while (true)
            {
                GlobalJoystickInputSource joystick = new GlobalJoystickInputSource(deviceIndex);
                joystick.UpdateState();

                if (joystick.IsAvailable)
                {
                    this.AddSource(joystick);
                }
                else if (deviceIndex >= MinDeviceCheckCount)
                {
                    break;
                }

                deviceIndex++;
            }
        }