Beispiel #1
0
 void OnApplicationPause(bool pause)
 {
     if (pause)
     {
         // Unregister event handlers when the applications pauses.
         if (streaming)
         {
             // removes data streaming event handler
             SpheroDeviceMessenger.SharedInstance.AsyncDataReceived -=
                 ReceiveAsyncMessage;
             // Turns off controller mode data streaming. Stabilization is restored and the back LED is turn off.
             m_Sphero.DisableControllerStreaming();
             streaming = false;
         }
         // Stop listening for disconnnect notifications.
         SpheroDeviceMessenger.SharedInstance.NotificationReceived -=
             ReceiveNotificationMessage;
         // Disconnect from the Sphero
         SpheroProvider.GetSharedProvider().DisconnectSpheros();
     }
     else
     {
         ViewSetup();
         streaming = false;
     }
 }