コード例 #1
0
 /// <summary>
 /// Scan data was received from the selected scanner.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private async void ClaimedScanner_DataReceived(ClaimedBarcodeScanner sender, BarcodeScannerDataReceivedEventArgs args)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         ScenarioOutputScanDataLabel.Text = DataHelpers.GetDataLabelString(args.Report.ScanDataLabel, args.Report.ScanDataType);
         ScenarioOutputScanData.Text      = DataHelpers.GetDataString(args.Report.ScanData);
         ScenarioOutputScanDataType.Text  = BarcodeSymbologies.GetName(args.Report.ScanDataType);
     });
 }
コード例 #2
0
 /// <summary>
 /// Event handler for the DataReceived event fired when a barcode is scanned by the barcode scanner
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"> Contains the BarcodeScannerReport which contains the data obtained in the scan</param>
 async void claimedScanner_DataReceived(ClaimedBarcodeScanner sender, BarcodeScannerDataReceivedEventArgs args)
 {
     // need to update the UI data on the dispatcher thread.
     // update the UI with the data received from the scan.
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         // read the data from the buffer and convert to string.
         ScenarioOutputScanDataLabel.Text = DataHelpers.GetDataLabelString(args.Report.ScanDataLabel, args.Report.ScanDataType);
         ScenarioOutputScanData.Text      = DataHelpers.GetDataString(args.Report.ScanData);
         ScenarioOutputScanDataType.Text  = BarcodeSymbologies.GetName(args.Report.ScanDataType);
     });
 }
コード例 #3
0
        /// <summary>
        /// This is an event handler for the claimed scanner Instance 2 when it scans and recieves data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private async void claimedBarcodeScannerInstance2_DataReceived(ClaimedBarcodeScanner sender, BarcodeScannerDataReceivedEventArgs args)
        {
            await MainPage.Current.Dispatcher.RunAsync(
                Windows.UI.Core.CoreDispatcherPriority.Normal,
                () =>
            {
                ScanDataType2.Text = BarcodeSymbologies.GetName(args.Report.ScanDataType);
                DataLabel2.Text    = DataHelpers.GetDataLabelString(args.Report.ScanDataLabel, args.Report.ScanDataType);
                ScanData2.Text     = DataHelpers.GetDataString(args.Report.ScanData);

                rootPage.NotifyUser("Instance 2 received data from the barcode scanner.", NotifyType.StatusMessage);
            }
                );
        }