It is necessary to make a QR code scanner found the Zxing library and examples of UWP to it. It seems that everything works and reads, but does not show on the screen what the camera sees (which is rather inconvenient) enter image description here

If there are those who have encountered such a problem, please accomplish your goal ... I just don’t even know where to look, look for other examples, or where it’s necessary to solve something or it’s just not provided for ...

Here is just in case the code:

public sealed partial class MainPage : Page { UIElement customOverlayElement = null; MobileBarcodeScanner scanner; public MainPage() { this.InitializeComponent(); //Create a new instance of our scanner scanner = new MobileBarcodeScanner(this.Dispatcher); scanner.Dispatcher = this.Dispatcher; } private void buttonScanDefault_Click(object sender, RoutedEventArgs e) { //Tell our scanner to use the default overlay scanner.UseCustomOverlay = false; //We can customize the top and bottom text of our default overlay scanner.TopText = "Hold camera up to barcode"; scanner.BottomText = "Camera will automatically scan barcode\r\n\r\nPress the 'Back' button to Cancel"; //Start scanning scanner.Scan().ContinueWith(t => { if (t.Result != null) HandleScanResult(t.Result); }); } async void HandleScanResult(ZXing.Result result) { string msg = ""; if (result != null && !string.IsNullOrEmpty(result.Text)) msg = "Found Barcode: " + result.Text; else msg = "Scanning Canceled!"; await MessageBox(msg); } async Task MessageBox(string text) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () => { var dialog = new MessageDialog(text); await dialog.ShowAsync(); }); } } 

    1 answer 1

    So, I found a completely normal solution for a beginner. http://www.soulier.ch/?p=2464

    It works for me perfectly + not so difficult to understand the code, as in the official examples of ZXing. The only, though insignificant, minus of this example, I consider it:

      while (true) { var stream = new InMemoryRandomAccessStream(); await _mediaCapture.CapturePhotoToStreamAsync(imgProp, stream); stream.Seek(0); var wbm = new WriteableBitmap(600, 800); await wbm.SetSourceAsync(stream); var result = bcReader.Decode(wbm); if (result != null) { var msgbox = new MessageDialog(result.Text); await msgbox.ShowAsync(); } } 

    Ie, he photographs in a continuous stream that takes RAM. If someone tells me how to fix it, I will be grateful)