public async void StartScanning() { _scanner = new MobileBarcodeScanner(); ScanStatusChanged?.Invoke(this, new ScanStatusEventArgs { ScanStatus = "Starting Scan" }); var result = await _scanner.Scan(); if (result != null) { ScanStatusChanged?.Invoke(this, new ScanStatusEventArgs { ScanStatus = "Scan Result Received" }); ScanResultFound?.Invoke(this, new ScanResultEventArgs { ScannedText = result.Text }); } else { ScanStatusChanged?.Invoke(this, new ScanStatusEventArgs { ScanStatus = "Scan Cancelled" }); } }
public bool Initialize() { ScanStatusChanged?.Invoke(this, new ScanStatusEventArgs { ScanStatus = "Initialized" }); return(true); }
void ScannerStatusChanged(object sender, Scanner.StatusEventArgs e) { if (e.P0 != null) { ScanStatusChanged?.Invoke(sender, new ScanStatusEventArgs { ScanStatus = e.P0.State.Name() }); } }
public void StopScanning() { ScanStatusChanged?.Invoke(this, new ScanStatusEventArgs { ScanStatus = "Stopping Scanning" }); if (_scanner != null) { try { _scanner?.Cancel(); _scanner = null; } catch (ObjectDisposedException) { } } }