Astroids.Classes.WiimoteHandler.CheckConnection C# (CSharp) Метод

CheckConnection() публичный Метод

public CheckConnection ( ) : bool
Результат bool
        public bool CheckConnection()
        {
            WiimoteCollection wmc = new WiimoteCollection();
            bool connected = false;

            foreach(Wiimote wm in wmList)
            {
                wmc.Add(wm);

                try
                {
                    wmc.FindAllWiimotes();
                    wm.Connect();
                    connected = true;
                }
                catch (WiimoteNotFoundException e)
                {
                    connected = false;
                    System.Windows.Forms.MessageBox.Show(e.Message);
                }
            }

            return connected;
        }

Usage Example

Пример #1
0
 public ControlHandler()
 {
     cActions = new List<string>();
     kbHandler = new KeyboardHandler();
     wmHandler = new WiimoteHandler();
     wiimoteIsConnected = wmHandler.CheckConnection();
 }