Hello,
i write an application using vbnet and Datalogic.API
All working fine , i open the application and i can capture the scanned barcode.
When i close the application i dispose the scanner using
If dcdEvent.IsListening() Then
hDcd.Dispose()
End If
When i run the application the secon time the scanner doesn’t send the scanned code to the application.
Any idea to fix this issue ?
Hello @MASSIMO_Chimetto
If the instance of DcdEvent is listening to a Decoder, you need to make sure to tell DcdEvent to stop listening before we delete DecodeHandler
I copy here below a code sample for a good de-initialization of DecodeHandler and DecodeEvent.
C#
/// Before the app or the dialog is closed, this method is called.
/// We do any necessary dialog clean up before the app shuts down.
private void DecoderDisposal()
{
// If our instance of DcdEvent is listening to the decoder, we need to make
// sure we tell DcdEvent to stop listening.
if (dcdEvent != null)
{
if (dcdEvent.IsListening)
{
dcdEvent.StopScanListener();
}
dcdEvent.Scanned -= dcdEvent_Scanned(); //optional
dcdEvent.TimeOut -= dcdEvent_TimeOut(); //optional
dcdEvent.Dispose(); //optional
dcdEvent = null; //optional
}
if (hDcd != null)
{
hDcd.Dispose();
}
}
VB.NET
Private Sub DecoderDisposal()
If dcdEvent IsNot Nothing Then
If dcdEvent.IsListening Then
dcdEvent.StopScanListener()
End If
dcdEvent.Scanned -= dcdEvent_Scanned()
dcdEvent.TimeOut -= dcdEvent_TimeOut()
dcdEvent.Dispose()
dcdEvent = Nothing
End If
If hDcd IsNot Nothing Then
hDcd.Dispose()
End If
End Sub
For further information, you get in contact with a Datalogic technician by filling out this form (link)
Simone Callegari
Datalogic Mobile - Products Specialist SW Engineer