public void Open() { try { //Microsoft.PointOfService.DeviceInfo devices = posExplorer.GetDevice(DeviceType.Msr, "Msr");; //msr = (Msr)posExplorer.CreateInstance(devices); this.AddDataEvent(msr); msr.ErrorEvent += new DeviceErrorEventHandler(msr_ErrorEvent); msr.Open(); msr.Claim(1000); msr.DeviceEnabled = true; deviceText = msr.DeviceDescription; statusText = msr.ToString(); msr.DataEventEnabled = true; status = MsrStatus.Active; this.RaiseStatusChangedEvent(); } catch (PosControlException e1) { status = MsrStatus.Inactive; //MessageBox.Show(e1.ToString()); this.RaiseStatusChangedEvent(); } catch (Exception e2) { status = MsrStatus.Inactive; //MessageBox.Show(e2.ToString() ); this.RaiseStatusChangedEvent(); } }
public void Close() { try { msr.Release(); msr.Close(); this.status = MsrStatus.Inactive; } catch { status = MsrStatus.Inactive; } }