Qian.BarcodeScanner.WPF
1.0.0
dotnet add package Qian.BarcodeScanner.WPF --version 1.0.0
NuGet\Install-Package Qian.BarcodeScanner.WPF -Version 1.0.0
<PackageReference Include="Qian.BarcodeScanner.WPF" Version="1.0.0" />
<PackageVersion Include="Qian.BarcodeScanner.WPF" Version="1.0.0" />
<PackageReference Include="Qian.BarcodeScanner.WPF" />
paket add Qian.BarcodeScanner.WPF --version 1.0.0
#r "nuget: Qian.BarcodeScanner.WPF, 1.0.0"
#:package Qian.BarcodeScanner.WPF@1.0.0
#addin nuget:?package=Qian.BarcodeScanner.WPF&version=1.0.0
#tool nuget:?package=Qian.BarcodeScanner.WPF&version=1.0.0
BarcodeScanner
Project Overview
BarcodeScanner is a WPF library for handling input from keyboards and barcode scanners. It provides flexible input mode support, including keyboard-only input, barcode scanner-only input, and a combined input mode. This library allows developers to easily integrate barcode scanner functionality into WPF applications.
Features
Supports Multiple Input Modes:
- Keyboard Input (
KeyboardInput) - Barcode Scanner Input (
BarcodeScannerInput) - Combined Input (
BothInput)
- Keyboard Input (
Device Management:
- Add and remove known devices.
- Cache device input states for improved performance.
Event Support:
- Provides the
ScanCoderouted event for handling barcode scanner input.
- Provides the
Easy Integration:
- Quickly bind to WPF controls using attached properties and event handlers.
Quick Start
1. Installation
Add the Qian.BarcodeScanner.WPF project to your solution and reference it in your WPF project.
2. Usage Example
XAML Example
<Window
x:Class="YourNamespace.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:qian="clr-namespace:Qian.BarcodeScanner;assembly=Qian.BarcodeScanner"
Title="Barcode Scanner Demo"
Width="525"
Height="350"
qian:BarcodeScannerManager.ScanCode="Window_ScanCode">
<StackPanel>
<TextBlock>BarcodeScannerInput:</TextBlock>
<TextBox
Width="300"
Height="30"
Margin="10"
qian:BarcodeScannerManager.InputMode="BarcodeScannerInput" />
<TextBlock>KeyboardInput:</TextBlock>
<TextBox
Width="300"
Height="30"
Margin="10"
qian:BarcodeScannerManager.InputMode="KeyboardInput" />
<TextBlock>BothInput:</TextBlock>
<TextBox
Width="300"
Height="30"
Margin="10"
qian:BarcodeScannerManager.InputMode="BothInput" />
<TextBlock x:Name="txtScanCode" />
</StackPanel>
</Window>
Code-Behind Example
using System.Windows;
using Qian.BarcodeScanner;
namespace YourNamespace
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Window_ScanCode(object sender, ScanCodeEventArgs e)
{
txtScanCode.Text = $"Scanned Code: {e.ScanCode}";
}
}
}
Input Modes
KeyboardInput: Supports keyboard input only.BarcodeScannerInput: Supports barcode scanner input only.BothInput: Supports both keyboard and barcode scanner input.
Events
ScanCode:
Triggered when barcode scanner input is completed, providing the scanned string.
Device Management
Add Known Devices
BarcodeScannerManager.AddBarcodeScannerKnownDevice("DevicePath");
BarcodeScannerManager.AddKeyboardKnownDevice("DevicePath");
Remove Known Devices
BarcodeScannerManager.RemoveKnownDevice(deviceInfo);
Contribution
Feel free to submit issues and contribute to the code!
License
This project is licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0-windows7.0 is compatible. net7.0-windows was computed. net8.0-windows was computed. net9.0-windows was computed. net10.0-windows was computed. |
-
net6.0-windows7.0
- RawInput.Sharp (>= 0.1.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 196 | 3/27/2025 |