I was trying to add QR code generator in my WPF app using instruction provided here: https://www.kailashsblogs.com/2020/05/generate-qr-code-in-wpf.html?m=0&fbclid=IwAR0CMMRGwE1eH-ASW4jVzML1oyEszLeSWAosK2QfuwOKCot_665O2aR1tEA
I installed ZXing.Net. But after copying code to my MainWindow.xaml.cs I was given errors "using the generic type 'barcodereader<t> ' requires 1 type arguments"
private void BtnConvert_Click(object sender, RoutedEventArgs e)
{
try
{
System.Drawing.Image img = null;
BitmapImage bimg = new BitmapImage();
using (var ms = new MemoryStream())
{
BarcodeWriter writer; <- HERE
writer = new ZXing.BarcodeWriter() { Format = BarcodeFormat.QR_CODE }; <-HERE
writer.Options.Height = 80;
writer.Options.Width = 280;
writer.Options.PureBarcode = true;
img = writer.Write(this.txtbarcodecontent.Text);
img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
ms.Position = 0;
bimg.BeginInit();
bimg.CreateOptions = BitmapCreateOptions.PreservePixelFormat;
bimg.CacheOption = BitmapCacheOption.OnLoad;
bimg.UriSource = null;
bimg.StreamSource = ms;
bimg.EndInit();
this.imgbarcode.Source = bimg;// return File(ms.ToArray(), "image/jpeg");
this.tbkbarcodecontent.Text = this.txtbarcodecontent.Text;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
using System.IO;
using ZXing;
using System.Drawing;
How can I repair it?