示例#1
0
        private void AddWiimoteDevices()
        {
            WiimoteCollection wiiMoteCollection = new WiimoteCollection();

            try
            {
                wiiMoteCollection.FindAllWiimotes();
            }
            catch (WiimoteNotFoundException) { }
            catch (WiimoteException)
            {
                Console.WriteLine("Wiimote error");
            }

            foreach (Wiimote wiimote in wiiMoteCollection)
            {
                if (!CheckIfWiimoteInputDeviceExists(wiimote))
                {
                    WiimoteInput input = new WiimoteInput(wiimote);
                    AddInputDevice(input);
                    input.InitCurrentlyInvokedInput();

                    wiimote.SetLEDs(false, false, false, false);

                    InvokeNewInputDeviceEvent(input.DeviceInstanceId, input);
                }
            }
        }
示例#2
0
 public void SetFlags(bool isConnected, bool isFlying, bool isHovering, bool isEmergency)
 {
     for (int i = 0; i < inputDevices.Count; i++)
     {
         if (inputDevices[i] is WiimoteInput)
         {
             WiimoteInput wiimoteInput = (WiimoteInput)inputDevices[i];
             wiimoteInput.SetLEDs(isConnected, isFlying, isHovering, isEmergency);
         }
     }
 }
        private void AddWiimoteDevices()
        {
            WiimoteCollection wiiMoteCollection = new WiimoteCollection();

            try
            {
                wiiMoteCollection.FindAllWiimotes();
            }
            catch (WiimoteNotFoundException) { }
            catch (WiimoteException)
            {
                Console.WriteLine("Wiimote error");
            }

            foreach (Wiimote wiimote in wiiMoteCollection)
            {
                if (!CheckIfWiimoteInputDeviceExists(wiimote))
                {
                    WiimoteInput input = new WiimoteInput(wiimote);
                    AddInputDevice(input);
                    input.InitCurrentlyInvokedInput();

                    wiimote.SetLEDs(false, false, false, false);

                    InvokeNewInputDeviceEvent(input.DeviceInstanceId, input);
                }
            }
        }