Skip to content

Examples in WinAppSDK? #540

Closed Answered by TheJoeFin
TheJoeFin asked this question in Q&A
Dec 17, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Following up here. I stopped trying to do the work Async and the issue went away. Here is a complete helper which works in WinAppSDK if anyone wants to copy/paste.

using Microsoft.UI.Xaml.Media.Imaging;
using System.Drawing;
using System.Drawing.Imaging;
using ZXing.Common;
using ZXing.QrCode.Internal;
using ZXing.Windows.Compatibility;

public static class BarcodeHelpers
{
    public static BitmapImage GetQrCodeBitmapFromText(string text, ErrorCorrectionLevel correctionLevel)
    {
        BitmapRenderer bitmapRenderer = new();
        bitmapRenderer.Foreground = Color.Black;
        bitmapRenderer.Background = Color.White;

        BarcodeWriter barcodeWriter = new()
        {
         …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@micjahn
Comment options

Answer selected by TheJoeFin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants