Example #1
0
 /***
  * This method is always called when the screen is disappearing (right before it happens).
  * If the counter is running (meaning the bluetooth thread is active, and reads data from the arduino),
  * updates askToQuit to "true" in order to end the thread, and stops the counter (updated the relevant UI).
  * Always disconnects from the bluetooth device.
  */
 protected override async void OnDisappearing()
 {
     if (timerRunning == true)
     {
         //in case the counter and bluetooth are on
         askToQuit                   = true;
         timerRunning                = false;
         startButton.Text            = "start riding";
         statButton.IsVisible        = true;
         myRidesButton.IsVisible     = true;
         changeRiderButton.IsVisible = true;
     }
     if (isBTConnected)
     {
         await btConnection.Disconnect();
     }
 }