Reputation: 97
I am trying to write a small application to read BarCode using Motorola MC5040 Symbol device. Clicking on a button on form should read BarCode. I am having hard time finding any sample projects. I reference Symbol and Symbol.Barcode DLLs Here is the code that is not working. Not sure how to control the side buttons on device either.
public partial class Form1 : Form
{
public static Symbol.Barcode.Reader SymbolReader = new Reader();
public static Symbol.Barcode.ReaderData SymbolReaderData = new ReaderData(ReaderDataTypes.Text, 100);
public static System.EventHandler SymbolEventHandler = null;
public Form1()
{
InitializeComponent();
InitScanner();
}
public void InitScanner()
{
SymbolEventHandler = new EventHandler(this.SymbolReader_ReadNotify);
SymbolReader.Actions.Enable();
}
public void SymbolReader_ReadNotify(object sender, EventArgs e)
{
SymbolReader.Actions.Enable();
Symbol.Barcode.ReaderData TheReaderData = SymbolReader.GetNextReaderData();
if (TheReaderData.Result == Symbol.Results.SUCCESS )
{
txtBarcode.Text = TheReaderData.Text.ToString();
SymbolReader_CycleScannerReader();
return;
}
SymbolReader_CycleScannerReader();
}
public void SymbolReader_CycleScannerReader()
{
SymbolReader.Actions.Read(SymbolReaderData);
}
private void button1_Click(object sender, EventArgs e)
{
SymbolReader_ReadNotify(sender, e);
}
}
}
Any pointers or correction will be great.
Upvotes: 1
Views: 2180
Reputation: 82
Here is a sample application using the Symbol.Barcode2 library https://github.com/bigfont/2013-128CG-Vendord/blob/master/HelpfulStuff/CS_Barcode2Sample1/API.cs
if you initialize a Barcode2
object you can then use that object to capture scan data
var myBarcode2Obj = new Barcode2();
myBarcode2Obj.OnScan += //Your scan even here;
Upvotes: 1