getDevices() public static méthode

public static getDevices ( ) : IList
Résultat IList
        private void Joystick_Load(object sender, EventArgs e)
        {
            try
            {
                DeviceList joysticklist = Joystick.getDevices();

                foreach (DeviceInstance device in joysticklist)
                {
                    CMB_joysticks.Items.Add(device.ProductName);
                }
            }
            catch { CustomMessageBox.Show("Error geting joystick list: do you have the directx redist installed?"); this.Close(); return; }

            if (CMB_joysticks.Items.Count > 0 && CMB_joysticks.SelectedIndex == -1)
            {
                CMB_joysticks.SelectedIndex = 0;
            }

            if (MainV2.config["joystick_name"] != "")
            {
                CMB_joysticks.Text = MainV2.config["joystick_name"].ToString();
            }

            CMB_CH1.DataSource = (Enum.GetValues(typeof(Joystick.joystickaxis)));
            CMB_CH2.DataSource = (Enum.GetValues(typeof(Joystick.joystickaxis)));
            CMB_CH3.DataSource = (Enum.GetValues(typeof(Joystick.joystickaxis)));
            CMB_CH4.DataSource = (Enum.GetValues(typeof(Joystick.joystickaxis)));
            CMB_CH5.DataSource = (Enum.GetValues(typeof(Joystick.joystickaxis)));
            CMB_CH6.DataSource = (Enum.GetValues(typeof(Joystick.joystickaxis)));
            CMB_CH7.DataSource = (Enum.GetValues(typeof(Joystick.joystickaxis)));
            CMB_CH8.DataSource = (Enum.GetValues(typeof(Joystick.joystickaxis)));

            try
            {
                CHK_elevons.Checked = bool.Parse(MainV2.config["joy_elevons"].ToString());
            }
            catch { } // IF 1 DOESNT EXIST NONE WILL

            var tempjoystick = new Joystick();

            label14.Text += " " + MainV2.comPort.MAV.cs.firmware.ToString();

            for (int a = 1; a <= 8; a++)
            {
                var config = tempjoystick.getChannel(a);

                findandsetcontrol("CMB_CH" + a, config.axis.ToString());
                findandsetcontrol("revCH" + a, config.reverse.ToString());
                findandsetcontrol("expo_ch" + a, config.expo.ToString());
            }

            if (MainV2.joystick != null && MainV2.joystick.enabled)
            {
                timer1.Start();
                BUT_enable.Text = "Disable";
            }

            startup = false;
        }
        private void CMB_joysticks_Click(object sender, EventArgs e)
        {
            CMB_joysticks.Items.Clear();

            var joysticklist = Joystick.getDevices();

            foreach (DeviceInstance device in joysticklist)
            {
                CMB_joysticks.Items.Add(device.ProductName.TrimUnPrintable());
            }

            if (CMB_joysticks.Items.Count > 0 && CMB_joysticks.SelectedIndex == -1)
            {
                CMB_joysticks.SelectedIndex = 0;
            }
        }
        private void CMB_joysticks_Click(object sender, EventArgs e)
        {
            CMB_joysticks.Items.Clear();

            DeviceList joysticklist = Joystick.getDevices();

            foreach (DeviceInstance device in joysticklist)
            {
                CMB_joysticks.Items.Add(device.ProductName);
            }

            if (CMB_joysticks.Items.Count > 0)
            {
                CMB_joysticks.SelectedIndex = 0;
            }
        }
        private void Joystick_Load(object sender, EventArgs e)
        {
            try
            {
                var joysticklist = Joystick.getDevices();

                foreach (DeviceInstance device in joysticklist)
                {
                    CMB_joysticks.Items.Add(device.ProductName.TrimUnPrintable());
                }
            }
            catch
            {
                CustomMessageBox.Show("Error geting joystick list: do you have the directx redist installed?");
                this.Close();
                return;
            }

            if (CMB_joysticks.Items.Count > 0 && CMB_joysticks.SelectedIndex == -1)
            {
                CMB_joysticks.SelectedIndex = 0;
            }

            try
            {
                if (Settings.Instance.ContainsKey("joystick_name") && Settings.Instance["joystick_name"].ToString() != "")
                {
                    CMB_joysticks.Text = Settings.Instance["joystick_name"].ToString();
                }
            }
            catch
            {
            }

            try
            {
                if (Settings.Instance.ContainsKey("joy_elevons"))
                {
                    CHK_elevons.Checked = bool.Parse(Settings.Instance["joy_elevons"].ToString());
                }
            }
            catch
            {
            } // IF 1 DOESNT EXIST NONE WILL

            var tempjoystick = new Joystick(() => MainV2.comPort);

            label14.Text += " " + MainV2.comPort.MAV.cs.firmware.ToString();

            var y = label8.Bottom;

            for (int a = 1; a <= maxaxis; a++)
            {
                var config = tempjoystick.getChannel(a);

                var ax = new JoystickAxis()
                {
                    ChannelNo    = a,
                    Label        = "Ch " + a,
                    AxisArray    = (Enum.GetValues(typeof(Joystick.joystickaxis))),
                    ChannelValue = config.axis.ToString(),
                    ExpoValue    = config.expo.ToString(),
                    ReverseValue = config.reverse,
                    Location     = new Point(0, y),
                    Name         = "axis" + a
                };

                ax.Detect  = () => Joystick.getMovingAxis(CMB_joysticks.Text, 16000).ToString();
                ax.Reverse = () => MainV2.joystick.setReverse(ax.ChannelNo, ax.ReverseValue);
                ax.SetAxis = () => MainV2.joystick.setAxis(ax.ChannelNo,
                                                           (Joystick.joystickaxis)Enum.Parse(typeof(Joystick.joystickaxis), ax.ChannelValue));
                ax.GetValue = () =>
                {
                    return((short)MainV2.comPort.MAV.cs.GetType().GetField("rcoverridech" + ax.ChannelNo)
                           .GetValue(MainV2.comPort.MAV.cs));
                };

                Controls.Add(ax);

                y += ax.Height;


                if ((ax.Bottom + 30) > this.Height)
                {
                    this.Height = ax.Bottom;
                }

                if ((ax.Right) > this.Width)
                {
                    this.Width = ax.Right;
                }
            }

            if (MainV2.joystick != null && MainV2.joystick.enabled)
            {
                timer1.Start();
                BUT_enable.Text = "Disable";
            }

            startup = false;
        }
        private void Joystick_Load(object sender, EventArgs e)
        {
            try
            {
                DeviceList joysticklist = Joystick.getDevices();

                foreach (DeviceInstance device in joysticklist)
                {
                    CMB_joysticks.Items.Add(device.ProductName);
                }
            }
            catch { CustomMessageBox.Show("Error geting joystick list: do you have the directx redist installed?"); this.Close(); return; }

            if (CMB_joysticks.Items.Count > 0)
            {
                CMB_joysticks.SelectedIndex = 0;
            }

            CMB_CH1.DataSource = (Enum.GetValues(typeof(Joystick.joystickaxis)));
            CMB_CH2.DataSource = (Enum.GetValues(typeof(Joystick.joystickaxis)));
            CMB_CH3.DataSource = (Enum.GetValues(typeof(Joystick.joystickaxis)));
            CMB_CH4.DataSource = (Enum.GetValues(typeof(Joystick.joystickaxis)));
            CMB_CH5.DataSource = (Enum.GetValues(typeof(Joystick.joystickaxis)));
            CMB_CH6.DataSource = (Enum.GetValues(typeof(Joystick.joystickaxis)));
            CMB_CH7.DataSource = (Enum.GetValues(typeof(Joystick.joystickaxis)));
            CMB_CH8.DataSource = (Enum.GetValues(typeof(Joystick.joystickaxis)));

            try
            {
                //CMB_CH1
                CMB_CH1.Text = MainV2.config["CMB_CH1"].ToString();
                CMB_CH2.Text = MainV2.config["CMB_CH2"].ToString();
                CMB_CH3.Text = MainV2.config["CMB_CH3"].ToString();
                CMB_CH4.Text = MainV2.config["CMB_CH4"].ToString();
                CMB_CH5.Text = MainV2.config["CMB_CH5"].ToString();
                CMB_CH6.Text = MainV2.config["CMB_CH6"].ToString();
                CMB_CH7.Text = MainV2.config["CMB_CH7"].ToString();
                CMB_CH8.Text = MainV2.config["CMB_CH8"].ToString();

                //revCH1
                revCH1.Checked = bool.Parse(MainV2.config["revCH1"].ToString());
                revCH2.Checked = bool.Parse(MainV2.config["revCH2"].ToString());
                revCH3.Checked = bool.Parse(MainV2.config["revCH3"].ToString());
                revCH4.Checked = bool.Parse(MainV2.config["revCH4"].ToString());
                revCH5.Checked = bool.Parse(MainV2.config["revCH5"].ToString());
                revCH6.Checked = bool.Parse(MainV2.config["revCH6"].ToString());
                revCH7.Checked = bool.Parse(MainV2.config["revCH7"].ToString());
                revCH8.Checked = bool.Parse(MainV2.config["revCH8"].ToString());

                //expo_ch1
                expo_ch1.Text = MainV2.config["expo_ch1"].ToString();
                expo_ch2.Text = MainV2.config["expo_ch2"].ToString();
                expo_ch3.Text = MainV2.config["expo_ch3"].ToString();
                expo_ch4.Text = MainV2.config["expo_ch4"].ToString();
                expo_ch5.Text = MainV2.config["expo_ch5"].ToString();
                expo_ch6.Text = MainV2.config["expo_ch6"].ToString();
                expo_ch7.Text = MainV2.config["expo_ch7"].ToString();
                expo_ch8.Text = MainV2.config["expo_ch8"].ToString();

                CHK_elevons.Checked = bool.Parse(MainV2.config["joy_elevons"].ToString());
            }
            catch { } // IF 1 DOESNT EXIST NONE WILL

            if (MainV2.joystick != null && MainV2.joystick.enabled)
            {
                timer1.Start();
                BUT_enable.Text = "Disable";
            }

            startup = false;
        }