Ejemplo n.º 1
0
        private void InputSelect_SelectedIndexChanged(object sender, EventArgs e)
        {
            PollingTimer.Enabled = false;
            mainDisplay.setInputSource(this.InputSelect.SelectedIndex);
            if (this.InputSelect.SelectedIndex == 0)
            {
                KeyboardOutput.Visible = false;
                WheelSelect.Items.Clear();
                PedalSelect.Items.Clear();
                joystick = mainDisplay.getJoystick();
                cps      = new DeviceCaps[mainDisplay.getNumJoys()];
                for (int i = 0; i < mainDisplay.getNumJoys(); i++)
                {
                    string joy = joystick[i].DeviceInformation.ProductName;
                    WheelSelect.Items.Add(joy);
                    PedalSelect.Items.Add(joy);
                    cps[i] = joystick[i].Caps;
                }
                state = mainDisplay.getJoystickState();
                SteeringAxisSelect.SelectedIndex    = mainDisplay.getDrivingAxis();
                BrakeAxisSelect.SelectedIndex       = mainDisplay.getBrakeAxis();
                AcceleratorAxisSelect.SelectedIndex = mainDisplay.getAccelAxis();
                ReverseButtonSelect.SelectedIndex   = mainDisplay.getReverseButton();
                DriveButtonSelect.SelectedIndex     = mainDisplay.getDriveButton();


                WheelSelect.SelectedIndex = mainDisplay.getPedalJoy();
                PedalSelect.SelectedIndex = mainDisplay.getWheelJoy();

                extraAxis = new int[mainDisplay.getNumJoys()][];
                buttons   = new int[mainDisplay.getNumJoys()][];
                info      = new string[2];//new string[mainDisplay.getNumJoys()];

                controlInitalized = true;

                Joystick1Info.Visible = true;
                Joystick2Info.Visible = true;
                JoyPanel.Visible      = true;
                PollingTimer.Enabled  = true;
            }
            else
            {
                pressedKeys            = mainDisplay.getPressedKeys();
                KeyboardOutput.Visible = true;
                Joystick1Info.Visible  = false;
                Joystick2Info.Visible  = false;
                JoyPanel.Visible       = false;
                controlInitalized      = false;
                PollingTimer.Enabled   = true;
            }
        }