public void OpenCashDrawer() { if (CacheBusinessLogic.UseCashDrawer) { if (CacheBusinessLogic.UseOposCashDrawer) { try { using (var cashDrawer = new OPOSCashDrawer(CacheBusinessLogic.CashDrawerName)) { cashDrawer.Open(); SoundService.Instance.PlaySoundFile(SoundTypes.drawerOpened); } } catch (CashDrawerException ex) { ShowNotification(ApplicationConstants.NoCashDrawerFound, null, null , ApplicationConstants.ButtonWarningColor); } } else { try { VMBase.Printer?.OpenCashDrawer(); SoundService.Instance.PlaySoundFile(SoundTypes.drawerOpened); } catch (Exception ex) { ShowNotification(ApplicationConstants.NoCashDrawerFound, null, null , ApplicationConstants.ButtonWarningColor); } } } }
public Window() { InitializeComponent(); Drawer = new OPOSCashDrawer(); Drawer.ClaimDevice(10); Drawer.Open("CashDrawer"); Drawer.DeviceEnabled = true; Drawer.StatusUpdateEvent += Drawer_StatusUpdateEvent; }
private void btnOpenCD_Click(object sender, EventArgs e) { OPOSCashDrawer cd = new OPOSCashDrawer(); int nRC = cd.Open("DefaultCashDrawer"); if (nRC == (int)OPOS_Constants.OPOS_SUCCESS) { cd.DeviceEnabled = true; nRC = cd.ClaimDevice(5000); if (nRC == (int)OPOS_Constants.OPOS_SUCCESS) { cd.DeviceEnabled = true; cd.OpenDrawer(); } } else { MessageBox.Show("Open failed"); } cd.ReleaseDevice(); cd.Close(); }