Dies wird getestet, um in Win 10 UWP-App zum Scannen von 1D-Barcodes (Format 39 & 128) integriert zu werden. Ich habe den letzten update bis nugget 2.0.4.46 aktualisiert. Referenzierter Beitrag unter http://www.yortondotnet.com/2015/07/mobile-barcode-scanning-with-zxingnet.html über einige Optionen Einstellung vor dem Scan() ohne Glück. Der Scanner (Kamera) öffnet sich, erkennt aber nie erfolgreich einen Barcode-Scan - oder einen Fehler in diesem Fall. Es scheint, dass überhaupt nichts geschieht. Ich habe einen direkten, passenden Beispielcode mit einigen Optionen zur Überprüfung hinzugefügt. Ich habe Scandit API zum Arbeiten bekommen und wollte es mit Manateeworks versuchen, aber beide sind sehr teuer und keine Option. Ich entwickle auf Surface Pro 3 (Win 10) und dieser Build wird auch Zielmaschinen sein, wenn sie fertig sind.ZXing.Net.Mobile Sample.WindowsUniversal Sample wird nicht gescannt
public sealed partial class MainPage : Page
{
UIElement customOverlayElement = null;
MobileBarcodeScanner scanner;
public MainPage()
{
this.InitializeComponent();
//Create a new instance of our scanner
scanner = new MobileBarcodeScanner(this.Dispatcher);
scanner.Dispatcher = this.Dispatcher;
}
private void buttonScanDefault_Click(object sender, RoutedEventArgs e)
{
//Tell our scanner to use the default overlay
scanner.UseCustomOverlay = false;
//We can customize the top and bottom text of our default overlay
scanner.TopText = "Hold camera up to barcode";
scanner.BottomText = "Camera will automatically scan barcode\r\n\r\nPress the 'Back' button to Cancel";
// GWS Set Options
var options = new MobileBarcodeScanningOptions();
options.PossibleFormats = new List<ZXing.BarcodeFormat>() {
ZXing.BarcodeFormat.CODE_39, ZXing.BarcodeFormat.CODE_128
};
options.AutoRotate = false;
options.TryHarder = false;
options.TryInverted = false;
//Start scanning
scanner.Scan(options).ContinueWith(t =>
{
if (t.Result != null)
HandleScanResult(t.Result);
});
}
private void buttonScanContinuously_Click(object sender, RoutedEventArgs e)
{
//Tell our scanner to use the default overlay
scanner.UseCustomOverlay = false;
//We can customize the top and bottom text of our default overlay
scanner.TopText = "Hold camera up to barcode";
scanner.BottomText = "Camera will automatically scan barcode\r\n\r\nPress the 'Back' button to Cancel";
// GWS Set Options
var options = new MobileBarcodeScanningOptions();
options.PossibleFormats = new List<ZXing.BarcodeFormat>() {
ZXing.BarcodeFormat.CODE_39, ZXing.BarcodeFormat.CODE_128
};
options.AutoRotate = false;
options.TryHarder = false;
options.TryInverted = false;
//Start scanning
scanner.ScanContinuously(options, async (result) =>
{
var msg = "Found Barcode: " + result.Text;
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
{
await MessageBox(msg);
});
});
}
async void HandleScanResult(ZXing.Result result)
{
string msg = "";
if (result != null && !string.IsNullOrEmpty(result.Text))
msg = "Found Barcode: " + result.Text;
else
msg = "Scanning Canceled!";
await MessageBox(msg);
}
}
Haben Sie versucht, indem Sie versuchen, härter zu wahren? – gayan1991