/// <summary> /// services control devices (joystick). /// </summary> private async void DoControlDevices() { // Repeat this loop until cancelled. while (!tokenSource.Token.IsCancellationRequested) { try { // call to open and maintain connection to joystick device: IJoystickSubState jss = await joystick.PollJoystick(); // just check for joystick existence. Data arrives in events. if (!joystick.IsEnabled) { Debug.WriteLine("ShortyTheRobot: Xbox Controller Not Found"); } shorty.ProcessControlDevices(); // give robot implementation a chance to maintain other control devices. } catch (Exception exc) { Debug.WriteLine("Error: DoControlDevices(): " + exc); } await Task.Delay(1000); } }