async public void Reclaim(string options) { PluginResult result; if (barcodeScanner != null) { claimedBarcodeScanner = await barcodeScanner.ClaimScannerAsync(); if (claimedBarcodeScanner != null) { await claimedBarcodeScanner.EnableAsync(); claimedBarcodeScanner.DataReceived += DataReceived; result = new PluginResult(PluginResult.Status.NO_RESULT); result.KeepCallback = true; } else { result = new PluginResult(PluginResult.Status.ERROR, "Barcode Scanner could not get claimed"); } } else { result = new PluginResult(PluginResult.Status.ERROR, "Barcode Scanner Object not exists"); } DispatchCommandResult(result); }
async public void Enable(string options) { PluginResult result; if (barcodeScanner == null) { barcodeScanner = await Windows.Devices.PointOfService.BarcodeScanner.GetDefaultAsync(); if (claimedBarcodeScanner == null) { claimedBarcodeScanner = await barcodeScanner.ClaimScannerAsync(); if (claimedBarcodeScanner != null) { await claimedBarcodeScanner.EnableAsync(); claimedBarcodeScanner.DataReceived += DataReceived; result = new PluginResult(PluginResult.Status.NO_RESULT); result.KeepCallback = true; } else { result = new PluginResult(PluginResult.Status.ERROR, "Barcode Scanner could not get claimed"); } } else { result = new PluginResult(PluginResult.Status.ERROR, "Claimed Barcode Scanner Object already there"); } } else { result = new PluginResult(PluginResult.Status.ERROR, "Barcode Scanner Object already there"); } DispatchCommandResult(result); }