public override void Open() { #if CF_BUILD DevicePath = "CF_Not_Implemented"; #endif // Device State checking done in base class base.Open(); // Initialize the CheckHealthText property to an empty string checkhealthtext = ""; // Set values for common statistics SetStatisticValue(StatisticManufacturerName, "Microsoft Corporation"); SetStatisticValue(StatisticManufactureDate, "2004-10-23"); SetStatisticValue(StatisticModelName, "Msr Simulator"); SetStatisticValue(StatisticMechanicalRevision, "1.0"); SetStatisticValue(StatisticInterface, "USB"); // Create a new manufacturer statistic CreateStatistic(PollingStatistic, false, "milliseconds"); // Set handlers for statistics stored in hardware SetStatisticHandlers(PollingStatistic, new GetStatistic(GetHardwareInfo), null); SetStatisticHandlers(StatisticSerialNumber, new GetStatistic(GetHardwareInfo), null); SetStatisticHandlers(StatisticFirmwareRevision, new GetStatistic(GetHardwareInfo), null); // Create instance of USB reader class hidReader = new HidReader(DeviceName, DevicePath, OnCardSwipe); hidReader.ThreadExceptionEvent += new HidReader.ThreadExceptionEventHandler(hidReader_ThreadExceptionEvent); }
public override void Open() { // Device State checking done in base class base.Open(); // Initialize the CheckHealthText property to an empty string checkhealthtext = ""; // Set values for common statistics SetStatisticValue(StatisticManufacturerName, "Microsoft Corporation"); SetStatisticValue(StatisticManufactureDate, "2004-05-23"); SetStatisticValue(StatisticModelName, "Scanner Simulator"); SetStatisticValue(StatisticMechanicalRevision, "1.0"); SetStatisticValue(StatisticInterface, "USB"); // Create instance of USB reader class hidReader = new HidReader(DeviceName, DevicePath, OnDataScanned); hidReader.ThreadExceptionEvent += new HidReader.ThreadExceptionEventHandler(hidReader_ThreadExceptionEvent); }
// We must override dispose so we can close and release our reference // to the ReadThread when the device is closed. // // The Base/Basic class implementation of Close() calls the virtual // Dispose(bool) method so we don't need to override Close(). protected override void Dispose(bool disposing) { try { //if (disposing) { // Release managed resources if (hidReader != null) { hidReader.CloseDevice(); hidReader.Dispose(); hidReader = null; } } } finally { // Must call base class Dispose base.Dispose(disposing); } }
// We must override dispose so we can close and release our reference // to the ReadThread when the device is closed. // // The Base/Basic class implementation of Close() calls the virtual // Dispose(bool) method so we don't need to override Close(). protected override void Dispose(bool disposing) { try { //if (disposing) { // Release managed resources if (hidReader != null) { hidReader.CloseDevice(); hidReader.Dispose(); hidReader = null; } } } finally { // Must call base class Dispose base.Dispose (disposing); } }