Exemple #1
0
 /// <summary>
 /// Try to create the WiiProvider (this involves connecting to the Wiimote).
 /// </summary>
 private bool createProvider()
 {
     try
     {
         // Connect a Wiimote, hook events then start.
         this.pWiiProvider = InputFactory.createInputProvider(Settings.Default.input);
         //this.pWiiProvider.OnNewFrame += new EventHandler<FrameEventArgs>(pWiiProvider_OnNewFrame);
         this.pWiiProvider.OnStatusUpdate += new Action <WiimoteStatus>(pWiiProvider_OnStatusUpdate);
         this.pWiiProvider.OnConnect      += new Action <int, int>(pWiiProvider_OnConnect);
         this.pWiiProvider.OnDisconnect   += new Action <int, int>(pWiiProvider_OnDisconnect);
         return(true);
     }
     catch (Exception pError)
     {
         // Tear down.
         try
         {
         }
         catch { }
         Console.WriteLine(pError.Message);
         // Report the error.cr
         ShowMessage(pError.Message, MessageType.Error);
         //MessageBox.Show(pError.Message, "WiiTUIO", MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
 }