Attached is a demo application showing some aspects of barcode scanning in C# on ITC devices. The demo source is written against CF2 and needs the right ITC datacollection runtime installed.
Datacollection runtimes (DC_NET.CAB) location:
+---WCE300
¦ +---Pocket PC 2002
¦ +---Arm
¦ +---X86
+---WCE420
¦ +---CV60
¦ ¦ +---X86
¦ +---iCE-Premium
¦ ¦ +---Armv4i
¦ +---iCE-Standard
¦ ¦ +---Armv4i
¦ +---Pocket PC 2003
¦ +---Armv4
¦ +---emulator
+---WCE500
¦ +---iCE50-CK60-A4i
¦ ¦ +---Armv4i
¦ +---ITC_CE5.0
¦ ¦ +---Armv4i
¦ +---WM5.0
¦ +---Armv4i
+---WCE600
¦ +---WM6
¦ +---Armv4i
+---XP
Here are some screens of ScanDemo:
The main code is the barcode read event handler. You have to wrap GUI updates in Delegate/Invoke or you will get problems earlier or later.
void BarcodeReader_BarcodeRead
( object sender, Intermec.DataCollection.BarcodeReadEventArgs bre )
{
brc = bre;
try
{
this.Invoke( new EventHandler(UpdateListBox) );
}
catch
{
}
}
protected void UpdateListBox( object sender, EventArgs e )
{
String s;
string sh;
String t;
if ( brc.Symbology > 0 && brc.Symbology < 0x20 )
{
t = bctype[brc.Symbology];
}
else
{
t = "n/a " + brc.Symbology.ToString();
}
s = "*" + brc.strDataBuffer + "* - " + t;
byte[] ba;
ba = brc.DataBuffer;
sh = s;
try
{
sh = HexEncoding.ToMixedString( ba );
}
catch( Exception ex )
{
System.Diagnostics.Debug.WriteLine( ex.Message );
}
if ( bUseHexMode )
{
s = sh;
}
if ( bUseListMode )
{
lblBarcode.Items.Add( s );
lblBarcode.SelectedIndex = lblBarcode.Items.Count - 1;
}
else
{
txtBarcode.Text = s;
}
}
<!-- Social Bookmarks BEGIN -->
<!-- Social Bookmarks END -->