Пример #1
0
        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"
                });
            }
        }
Пример #2
0
        public bool Initialize()
        {
            ScanStatusChanged?.Invoke(this, new ScanStatusEventArgs {
                ScanStatus = "Initialized"
            });

            return(true);
        }
Пример #3
0
 void ScannerStatusChanged(object sender, Scanner.StatusEventArgs e)
 {
     if (e.P0 != null)
     {
         ScanStatusChanged?.Invoke(sender, new ScanStatusEventArgs {
             ScanStatus = e.P0.State.Name()
         });
     }
 }
Пример #4
0
        public void StopScanning()
        {
            ScanStatusChanged?.Invoke(this, new ScanStatusEventArgs {
                ScanStatus = "Stopping Scanning"
            });

            if (_scanner != null)
            {
                try {
                    _scanner?.Cancel();
                    _scanner = null;
                } catch (ObjectDisposedException) {
                }
            }
        }