我正在使用 .Net Maui 读取条形码,我发现了一些使用设备默认摄像头的东西。然而,我正在使用的应用程序需要使用设备的集成条形码读取器而不是相机。如何使用 .Net MAUI 或 XAMARIN 来实现这一点。
对于 Zebra 设备,建议使用 Zebra DataWedge。
请参阅 https://techdocs.zebra.com/datawedge/latest/guide/api/softscantrigger/ 此处为例。
(手册是为 Xamarin 编写的,但在毛伊岛的用法几乎相同。)
来自他们的网站: ZXing.Net.Mobile 的后继者:.NET MAUI 应用程序的条形码扫描和生成。首先,我们需要将 ZXing.Net.MAUI 库作为依赖项添加到我们的项目中。为此,请打开 NuGet 包管理器并搜索“ZXing.Net.MAUI”。在您的 .NET MAUI 项目中安装该包。
// Add the using to the top
using ZXing.Net.Maui;
// ... other code
public static MauiApp Create() {
var builder = MauiApp.CreateBuilder();
builder.UseMauiApp & lt;
App & gt;
().UseBarcodeReader(); // Make sure to add this line
return builder.Build();
}