public override void Close() { VerifyResult(_cco.Close()); _cco.DataEvent -= (_IOPOSElectronicValueRWEvents_DataEventEventHandler)_cco_DataEvent; _cco.DirectIOEvent -= (_IOPOSElectronicValueRWEvents_DirectIOEventEventHandler)_cco_DirectIOEvent; _cco.ErrorEvent -= (_IOPOSElectronicValueRWEvents_ErrorEventEventHandler)_cco_ErrorEvent; _cco.OutputCompleteEvent -= (_IOPOSElectronicValueRWEvents_OutputCompleteEventEventHandler)_cco_OutputCompleteEvent; _cco.StatusUpdateEvent -= (_IOPOSElectronicValueRWEvents_StatusUpdateEventEventHandler)_cco_StatusUpdateEvent; _cco.TransitionEvent -= (_IOPOSElectronicValueRWEvents_TransitionEventEventHandler)_cco_TransitionEvent; _cco = null; }
public override void Open() { if (string.IsNullOrWhiteSpace(_oposDeviceName)) { try { _oposDeviceName = GetConfigurationProperty("OposDeviceName"); _oposDeviceName.Trim(); } catch { _oposDeviceName = ""; } } if (string.IsNullOrWhiteSpace(_oposDeviceName)) { string strMessage = "OposDeviceName is not configured on " + DevicePath + "."; throw new Microsoft.PointOfService.PosControlException(strMessage, ErrorCode.NoExist); } if (_cco == null) { try { // CCO object CreateInstance _cco = new OpenPOS.Devices.OPOSElectronicValueRW(); // Register event handler _cco.DataEvent += new _IOPOSElectronicValueRWEvents_DataEventEventHandler(_cco_DataEvent); _cco.DirectIOEvent += new _IOPOSElectronicValueRWEvents_DirectIOEventEventHandler(_cco_DirectIOEvent); _cco.ErrorEvent += new _IOPOSElectronicValueRWEvents_ErrorEventEventHandler(_cco_ErrorEvent); _cco.OutputCompleteEvent += new _IOPOSElectronicValueRWEvents_OutputCompleteEventEventHandler(_cco_OutputCompleteEvent); _cco.StatusUpdateEvent += new _IOPOSElectronicValueRWEvents_StatusUpdateEventEventHandler(_cco_StatusUpdateEvent); _cco.TransitionEvent += new _IOPOSElectronicValueRWEvents_TransitionEventEventHandler(_cco_TransitionEvent); } catch { string strMessage = "Can not create Common ControlObject on " + DevicePath + "."; throw new Microsoft.PointOfService.PosControlException(strMessage, ErrorCode.Failure); } } VerifyResult(_cco.Open(_oposDeviceName)); }
protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { // TODO: Discard the managed state (managed object). } if (_cco != null) { _cco.DataEvent -= (_IOPOSElectronicValueRWEvents_DataEventEventHandler)_cco_DataEvent; _cco.DirectIOEvent -= (_IOPOSElectronicValueRWEvents_DirectIOEventEventHandler)_cco_DirectIOEvent; _cco.ErrorEvent -= (_IOPOSElectronicValueRWEvents_ErrorEventEventHandler)_cco_ErrorEvent; _cco.OutputCompleteEvent -= (_IOPOSElectronicValueRWEvents_OutputCompleteEventEventHandler)_cco_OutputCompleteEvent; _cco.StatusUpdateEvent -= (_IOPOSElectronicValueRWEvents_StatusUpdateEventEventHandler)_cco_StatusUpdateEvent; _cco.TransitionEvent -= (_IOPOSElectronicValueRWEvents_TransitionEventEventHandler)_cco_TransitionEvent; _cco = null; } _disposedValue = true; } }
public OpenPOSElectronicValueRW() { _cco = null; _oposDeviceName = ""; _binaryConversion = 0; }