Created
December 13, 2019 05:00
-
-
Save marqzosvaldo/0168b81b919ce93daee47af483cfb34e to your computer and use it in GitHub Desktop.
CommandDesconectarDispositivo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private ICommand _desconnectCommand; | |
public ICommand DesconnectCommand => _desconnectCommand ?? (_desconnectCommand = new Command(async (item) => { | |
var device = item as IDevice; | |
try { | |
if(device.State == Plugin.BLE.Abstractions.DeviceState.Disconnected) { | |
throw new System.ArgumentException("Dispositivo no puede estar desconectado", "devicel.state"); | |
} | |
await _adapter.DisconnectDeviceAsync(device); | |
await page.DisplayAlert("Desconectado", $"Status {device.State}", "Ok"); | |
} catch (Exception ex) { | |
await page.DisplayAlert("El Dispositivo aun no ha sido conectado", $"Status {device.State}", "Ok"); | |
Debug.WriteLine(ex); | |
} | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment