private void DrawerCheckTimer_Elapsed(object sender, ElapsedEventArgs e) { CashDrawerStatus = (CashDrawerStatus)Micros.CashDrawerStatus(CDNumber); if (PreviousDrawerStatus != CashDrawerStatus && CashDrawerStatusChanged != null) { CashDrawerStatusChanged.Invoke(CashDrawerStatus); } PreviousDrawerStatus = CashDrawerStatus; }
public CashDrawer(uint CashDrawerNumber = 1) { CDNumber = CashDrawerNumber; Micros.CashDrawerVerifyPassword("000000", "0"); CashDrawerStatus = (CashDrawerStatus)Micros.CashDrawerStatus(CDNumber); DrawerCheckTimer.Interval = 10; DrawerCheckTimer.Elapsed += DrawerCheckTimer_Elapsed; DrawerCheckTimer.Start(); }
private void OnCashDrawerClose() { if (currentCashDrawerStatus != CashDrawerStatus.Close) { Dispatcher.BeginInvoke(new Action(() => { StatusTextBlock.Text = "Cash Drawer Close."; StatusTextBlock.Foreground = new SolidColorBrush(Colors.Blue); }) ); } currentCashDrawerStatus = CashDrawerStatus.Close; }
private void OnCashDrawerOpen() { if (currentCashDrawerStatus != CashDrawerStatus.Open) { Dispatcher.BeginInvoke(new Action(() => { StatusTextBlock.Text = "Cash Drawer Open."; StatusTextBlock.Foreground = new SolidColorBrush(Colors.Magenta); }) ); } currentCashDrawerStatus = CashDrawerStatus.Open; }
private void OnPrinterImpossible() { if (currentCashDrawerStatus != CashDrawerStatus.Impossible) { Dispatcher.BeginInvoke(new Action(() => { StatusTextBlock.Text = "Printer Impossible."; StatusTextBlock.Foreground = new SolidColorBrush(Colors.Red); }) ); } currentCashDrawerStatus = CashDrawerStatus.Impossible; }
/// <summary> /// Sample : Starting monitoring printer. /// </summary> public void Connect() { try { if (port == null) { // Your printer PortName and PortSettings. string portName = SharedInformationManager.GetSelectedPortName(); string portSettings = SharedInformationManager.GetSelectedPortStrrings(); port = Factory.I.GetPort(portName, portSettings, 10000); // First, clear barcode reader buffer. ClearBarcodeReaderBuffer(); } } catch (PortException) // Port open is failed. { DidConnectFailed(); return; } try { if (monitoringPrinterThread == null || monitoringPrinterThread.ThreadState == ThreadState.Stopped) { monitoringPrinterThread = new Thread(MonitoringPrinter); monitoringPrinterThread.Name = "MonitoringPrinterThread"; monitoringPrinterThread.IsBackground = true; monitoringPrinterThread.Start(); } } catch (Exception) // Start monitoring printer thread is failure. { DidConnectFailed(); } currentPrinterStatus = PrinterStatus.Invalid; currentPaperStatus = PaperStatus.Invalid; currentCoverStatus = CoverStatus.Invalid; currentCashDrawerStatus = CashDrawerStatus.Invalid; currentBarcodeReaderStatus = Communication.PeripheralStatus.Invalid; }
/// <summary> /// Sample : Starting monitoring printer. /// </summary> public void Connect() { try { if (port == null) { // Your printer PortName and PortSettings. string portName = SharedInformationManager.SelectedPortName; string portSettings = SharedInformationManager.SelectedPortSettings; port = Factory.I.GetPort(portName, portSettings, 10000); } } catch (PortException) // Port open is failed. { DidConnectFailed(); return; } try { if (monitoringPrinterThread == null || monitoringPrinterThread.ThreadState == ThreadState.Stopped) { monitoringPrinterThread = new Thread(MonitoringPrinter); monitoringPrinterThread.Name = "MonitoringPrinterThread"; monitoringPrinterThread.IsBackground = true; monitoringPrinterThread.Start(); } } catch (Exception) // Start monitoring printer thread is failure. { DidConnectFailed(); } currentCashDrawerStatus = CashDrawerStatus.Invalid; }
private void CashDrawer_CashDrawerStatusChanged(CashDrawerStatus cashDrawerStatus) { UpdateStatus(); }