Ejemplo n.º 1
0
        private void StereoConnectButton_Click(object sender, EventArgs e)
        {
            // Get the device paths of all wiimotes in the HID device list
            StringCollection devicePaths = Wiimote.FindAllWiiMotes();

            if (devicePaths.Count >= 2)
            {
                try
                {
                    wm1.Connect(devicePaths[0]);
                }
                catch
                {
                    MessageBox.Show("Wiimote 1 could not be connected, Exception thrown by Connect() method.");
                    return;
                }

                try
                {
                    wm2.Connect(devicePaths[1]);
                }
                catch
                {
                    MessageBox.Show("Wiimote 1 could not be connected, Exception thrown by Connect() method.");
                    return;
                }

                wm1.SetReportType(InputReport.IRAccel, true);
                _wm1ID = wm1.ID;
                wm1.SetLEDs(true, false, false, false);

                wm2.SetReportType(InputReport.IRAccel, true);
                _wm2ID = wm2.ID;
                wm2.SetLEDs(false, true, false, false);
            }
            else
            {
                MessageBox.Show("Not enough wiimotes were found in the HID device list, is there 2 connected?");
            }
        }