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(); }
public POSCashDrawer() { m_device = new OPOSCashDrawer(); }
protected Task <bool> VerifyPeripheralsConnected() { Action printerError = default(Action); Action cashDrawerError = default(Action); Action lineDisplayError = default(Action); printerError = new Action(async() => { if (CacheBusinessLogic.UseReceiptPrinter && CacheBusinessLogic.UseOposReceiptPrinter) { if (OposPrinter == null) { ClaimOposPrinter(); } if (OposPrinter != null && OposPrinter.IsAvailable()) { cashDrawerError(); } else { ShowNotification(ApplicationConstants.NoPrinterFound, cashDrawerError, cashDrawerError, ApplicationConstants.ButtonWarningColor); } } else { ClaimOposPrinter(); cashDrawerError(); } }); cashDrawerError = new Action(async() => { if (CacheBusinessLogic.UseCashDrawer && CacheBusinessLogic.UseOposCashDrawer) { try { using (var cashDrawer = new OPOSCashDrawer(CacheBusinessLogic.CashDrawerName)) { } lineDisplayError(); } catch (CashDrawerException ex) { ShowNotification(ApplicationConstants.NoCashDrawerFound, lineDisplayError, lineDisplayError , ApplicationConstants.ButtonWarningColor); } } else { lineDisplayError(); } }); lineDisplayError = new Action(async() => { if (CacheBusinessLogic.UseCustomerDisplay && CacheBusinessLogic.UseOposCustomerDisplay) { try { using (var lineDisplay = new OPOSLineDisplay(CacheBusinessLogic.CustomerDisplayName)) { } } catch (LineDisplayException ex) { Log.Warn(ex); DisplayCustomerDisplayMessage = false; ShowNotification(ApplicationConstants.NoCustomerDisplayFound, null, null, ApplicationConstants.ButtonWarningColor); } catch (Exception ex) { Log.Info(Message, ex); DisplayCustomerDisplayMessage = false; ShowNotification(ApplicationConstants.SomethingBadHappned, null, null, ApplicationConstants.ButtonWarningColor); } } }); printerError(); return(Task.FromResult <bool>(true)); }