Пример #1
0
 private void DrawerCheckTimer_Elapsed(object sender, ElapsedEventArgs e)
 {
     CashDrawerStatus = (CashDrawerStatus)Micros.CashDrawerStatus(CDNumber);
     if (PreviousDrawerStatus != CashDrawerStatus && CashDrawerStatusChanged != null)
     {
         CashDrawerStatusChanged.Invoke(CashDrawerStatus);
     }
     PreviousDrawerStatus = CashDrawerStatus;
 }
Пример #2
0
 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();
 }
Пример #3
0
        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;
        }
Пример #4
0
        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;
        }
Пример #6
0
        /// <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;
        }
Пример #7
0
        /// <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;
        }
Пример #8
0
 private void CashDrawer_CashDrawerStatusChanged(CashDrawerStatus cashDrawerStatus)
 {
     UpdateStatus();
 }