async void SearchBand() { try { var bandClientManager = BandClientManager.Instance; // query the service for paired devices var pairedBands = await bandClientManager.GetPairedBandsAsync(); // connect to the first device var bandInfo = pairedBands.FirstOrDefault(); var bandClient = await bandClientManager.ConnectAsync(bandInfo); DeviceScanUpdate?.Invoke(this, bandInfo.Name); await Task.Delay(3000); DeviceScanTimeout?.Invoke(this, null); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); await Task.Delay(3000); DeviceScanTimeout?.Invoke(this, null); } }
private void _adapter_DeviceDiscovered(IDevice device) { _devices?.Add(device); DeviceScanUpdate?.Invoke(this, device.Name); }