[SerializableAttribute()]
public enum BarcodeReadSymbologyOperation
typedef NS_ENUM(NSInteger, LTBarcodeReadSymbologyOperation) {
LTBarcodeReadSymbologyOperationPreRead,
LTBarcodeReadSymbologyOperationPostRead
};
public enum BarcodeReadSymbologyOperation
[SerializableAttribute()]
public enum class BarcodeReadSymbologyOperation
class BarcodeReadSymbologyOperation(Enum):
PreRead = 0
PostRead = 1
Value | Member | Description |
---|---|---|
0 | PreRead |
The BarcodeReader object is about to read the barcode symbologies. The input parameters are: The symbologies to be read which can be obtained through the GetSymbologies method and the associated read options that are in the Options property. |
1 | PostRead |
The BarcodeReader has finished reading the barcode symbologies. The input parameters are: The symbologies to be read which can be obtained through the GetSymbologies method and the associated read options that are in the Options property. The resulting parameters are: The barcode data found which is in the Data property that may contain a valid BarcodeData object or null (Nothing in Visual Basic) when an error occurs or no barcode of this type is found. In case of an error, the exception is in the Error property (Refer to BarcodeReader.ErrorMode for more information). |
This enumeration is used as the type for the BarcodeReadSymbologyEventArgs.Operation property that can be used to determine the current barcode read stage.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Barcode;
using Leadtools.ImageProcessing;
public void BarcodeReader_ReadSymbologyExample()
{
string imageFileName = Path.Combine(LEAD_VARS.ImagesDir, "Barcode1.tif");
// Create a Barcode engine
BarcodeEngine engine = new BarcodeEngine();
// Get the Barcode reader instance
BarcodeReader reader = engine.Reader;
// Load the image
using (RasterCodecs codecs = new RasterCodecs())
{
using (RasterImage image = codecs.Load(imageFileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1))
{
// Subscribe to the ReadSymbology event
reader.ReadSymbology += new EventHandler<BarcodeReadSymbologyEventArgs>(reader_ReadSymbology);
// Read all barcodes in the image
reader.ReadBarcodes(image, LeadRect.Empty, 0, null);
reader.ReadSymbology -= new EventHandler<BarcodeReadSymbologyEventArgs>(reader_ReadSymbology);
}
}
}
private void reader_ReadSymbology(object sender, BarcodeReadSymbologyEventArgs e)
{
if (e.Operation == BarcodeReadSymbologyOperation.PreRead)
{
// Before reading, show the symbologies the engine is going to try to read
Console.WriteLine("Trying to read the following symbologies:");
BarcodeSymbology[] symbologies = e.GetSymbologies();
for (int i = 0; i < symbologies.Length; i++)
{
Console.Write(symbologies[i]);
if (i != (symbologies.Length - 1))
{
Console.Write(", ");
Console.WriteLine(e.Options.FriendlyName);
}
else
{
Console.WriteLine();
}
}
}
else if (e.Operation == BarcodeReadSymbologyOperation.PostRead)
{
if (e.Error == null)
{
// No errors
BarcodeData barcode = e.Data;
if (barcode != null)
{
// Found a barcode, show it
Console.WriteLine(" {0} at {1} with data {2}", barcode.Symbology, barcode.Bounds, barcode.Value);
}
else
{
Console.WriteLine(" No barcodes found");
}
}
else
{
// Show the error
Console.WriteLine("Error: {0}", e.Error.Message);
// Tell the reader top stop reading barcodes
e.Status = BarcodeReadSymbologyStatus.Abort;
}
}
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document