使用zxing.net组件,读取BitmapSource中的二维码。简单使用方法如下:
private void DecodeQrCode() { if (QrCodeSource.CanFreeze) { QrCodeSource.Freeze(); } using (var bitmap = BitmapSourceToBitmap(QrCodeSource)) { var source = new BitmapLuminanceSource(bitmap); var bBitmap = new BinaryBitmap(new HybridBinarizer(source)); var result = new MultiFormatReader().decode(bBitmap); ResultValue = result?.Text; } }