private async Task <bool> ConnectDeviceAsync(DeviceListItemViewModel device, bool showPrompt = true) { if (device.IsConnected) { return(true); } if (showPrompt && !await _userDialogs.ConfirmAsync($"Connect to device '{device.Name}'?")) { return(false); } try { _userDialogs.ShowLoading("Connecting ..."); await Adapter.ConnectToDeviceAync(device.Device); _userDialogs.InfoToast($"Connected to {device.Device.Name}."); PreviousGuid = device.Device.Id; return(true); } catch (Exception ex) { _userDialogs.Alert(ex.Message, "Connection error"); Mvx.Trace(ex.Message); return(false); } finally { _userDialogs.HideLoading(); device.Update(); } }