public async Task <bool> ConnectDeviceAsync(DeviceItemViewModel device) { try { await adapter.ConnectToDeviceAsync(device.Device); } catch (DeviceConnectionException ex) { Debug.WriteLine("Error ConnectDeviceAsync : " + ex); } return(true); }
public async void HandleSelectedDevice(DeviceItemViewModel device) { if (await ConnectDeviceAsync(device)) { MessagingCenter.Subscribe <string>(this, "senddevice", (arg) => { MessagingCenter.Send(device, "connectdevice"); }); await adapter.StopScanningForDevicesAsync(); await navigation.PushAsync(new ServiceList(user) { Title = "Services" }); } }