private async Task HandleNewNuimoController(INuimoController nuimoController) { AddDelegates(nuimoController); while (!await nuimoController.ConnectAsync()) { } nuimoController.HeartBeatInterval = TimeSpan.FromSeconds(2); NextApp(nuimoController); }
private async void ConnectButton_OnClick(object sender, RoutedEventArgs e) { if (_nuimoControllers == null) { return; } var oldNuimoController = _nuimoController; if (oldNuimoController != null) { RemoveDelegates(oldNuimoController); } _nuimoController = _nuimoControllers.ElementAt(PairedNuimosComboBox.SelectedIndex); AddDelegates(_nuimoController); switch (_nuimoController.ConnectionState) { case NuimoConnectionState.Disconnected: await _nuimoController.ConnectAsync(); break; case NuimoConnectionState.Connected: await _nuimoController.DisconnectAsync(); break; } }