Exemplo n.º 1
0
 /// <summary>
 /// Connect to the Pebble that's currently selected in the combobox, if any.
 /// </summary>
 private void ConnectToSelectedPebble()
 {
     pebble = PebbleList.SelectedItem as Pebble;
     if (pebble != null)
     {
         pebble.OnConnect            += pebble_OnConnect;
         pebble.OnDisconnect         += pebble_OnDisconnect;
         pebble.MediaControlReceived += pebble_MediaControlReceived;
         try
         {
             pebble.Connect();
         }
         catch (IOException e)
         {
             MessageBox.Show("Failed to connect: " + e.Message);
             pebble = null;
         }
         catch (UnauthorizedAccessException e)
         {
             MessageBox.Show("Failed to connect: " + e.Message);
             pebble = null;
         }
     }
 }