public static void QREncodeDecode() { string data = "test msg"; var writableBitmap = QRSenderHelper.CreateQRWritableBitampFromString(data); //var barcodeResult = barcodeReader.Decode(new BitmapSourceLuminanceSource(writableBitmap)); var bmp = WritableBitmapToBitmap(writableBitmap); var barcodeResult = QRMessageScannerHelper.GetBarcodeResultFromQRBitmap(bmp); MessageBox.Show($"{barcodeResult.Text}"); }
private async Task <string> WaitForSuccessfullyDecodedQRAsync() { Result barcodeResult = null; while (barcodeResult == null) { var bitmap = QRMessageScannerHelper.CreateBitmapFromScreen(); barcodeResult = QRMessageScannerHelper.GetBarcodeResultFromQRBitmap(bitmap); long minDelayMs = QRReceiverSettings.ScanPeriodForSettingsMessageMilliseconds; long elapsedMs = this.sw.ElapsedMilliseconds; int timeToWaitMs = (int)(minDelayMs - elapsedMs); if (timeToWaitMs > 0) { await Task.Delay(timeToWaitMs); } } return(barcodeResult.Text); }