Пример #1
0
 /// <summary>
 /// Stops the match early and does not send the results to the leaderboard for that match unless the override send button is pressed
 /// Useful for overriding scores of teams because of fouls or penalties
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void stopButton_Click(object sender, EventArgs e)
 {
     Console.WriteLine("Stop button is pushed!");
     GameUtility.doSend = false;
     GameUtility.endMatch();
     GameUtility.makeSpeech("The match was stopped by the referee.");
 }
Пример #2
0
 /// <summary>
 /// This function is threaded and just checks to see if the COm port is still connected,
 /// aka, if the arduino is still plugged in after connection has been established
 /// </summary>
 public static void isConnectionAlive()
 {
     while (true)
     {
         if (arduinoport.IsOpen)
         {
             Console.WriteLine("Port is still alive.");
         }
         else
         {
             Console.WriteLine("Comms port is dead");
             GameUtility.pauseMatch();
             GameUtility.makeSpeech("Warning: connection with arduino controller lost! Match Auto-pausing!");
             MessageBox.Show("Lost Connection with Arduino Controller.\n" +
                             "Please ensure the cable is fully plugged in and the arduino is on,\n" +
                             "then reconnect the arduino using the Arduino button.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             break;
         }
         Thread.Sleep(100);
     }
 }