QR Code Talker: Karen’s Next Power Tool Utility for Windows

QR Code Talker is a simple QR Code generator. You type in some text and it shows you a QR code. Simple.

This project is based on open source work by Raffael Herrmann (codebude) on GitHub at https://github.com/codebude/QRCoder.

Karen’s QR Code Talker free utility for Microsoft Windows #qrcodegenerator
Testing the QR codes generated while I type.

Here’s some code

The program isn’t done yet, but here’s what makes it work.

using QRCoder; //https://github.com/codebude/QRCoder/wiki

namespace QRCodeTalker
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        protected QRCodeGenerator _qrGenerator = new();


        public MainWindow()
        {
            InitializeComponent();

            UpdateQRCode(qrText.Text);




        }

        public void UpdateQRCode( string text )
        {
            
            QRCodeData qrCodeData = _qrGenerator.CreateQrCode(text, QRCodeGenerator.ECCLevel.Q);
            QRCode qrCode = new QRCode(qrCodeData);
            Bitmap qrCodeImage = qrCode.GetGraphic(20);

            UpdateQRCodeImage(qrCodeImage);


        }

        public void UpdateQRCodeImage( Bitmap bitmapQRCode )
        {

            // https://stackoverflow.com/questions/94456/load-a-wpf-bitmapimage-from-a-system-drawing-bitmap
            using MemoryStream memory = new();

            bitmapQRCode.Save(memory, ImageFormat.Png);
            memory.Position = 0;

            BitmapImage bitmapImage = new();

            bitmapImage.BeginInit();
            bitmapImage.StreamSource = memory;
            bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
            bitmapImage.EndInit();

            qrImage.Source = bitmapImage;

        }

        private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            UpdateQRCode(qrText.Text);
        }
    }
}
<Window x:Class="QRCodeTalker.MainWindow">
    <Grid>
        <Image x:Name="qrImage" HorizontalAlignment="Left" Height="200" Margin="10,103,0,0" VerticalAlignment="Top" Width="200"/>
        <TextBox x:Name="qrText" Margin="10,57,10,0" TextWrapping="Wrap" Text="https://www.karenware.com/" VerticalAlignment="Top" TextChanged="TextBox_TextChanged" Height="24"/>
        <Label Content="URL or Text to Encode" HorizontalAlignment="Left" Margin="10,31,0,0" VerticalAlignment="Top" Width="160"/>

    </Grid>
</Window>

1 thought on “QR Code Talker: Karen’s Next Power Tool Utility for Windows”

  1. Pingback: I’ve written Karen’s QR Code Talker (a Windows Program to Generate QR Codes for You) – TeddyBear.com

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top