private void openDrawer() { if (m_Drawer != null) { try { //Open the device //Use a Logical Device Name which has been set on the SetupPOS. m_Drawer.Open(); //Get the exclusive control right for the opened device. //Then the device is disable from other application. m_Drawer.Claim(1000); //Enable the device. m_Drawer.DeviceEnabled = true; //Open the drawer by using the "OpenDrawer" method. m_Drawer.OpenDrawer(); m_Drawer.DeviceEnabled = false; m_Drawer.Release(); m_Drawer.Close(); } catch (Exception) { useNativePrinter(); } } else { useNativePrinter(); } }
private static void InitializeCashDrawer2() { DeviceCollection cashDrawerList = CashDrawerDeviceCollection; if (cashDrawerList.Count > 0) { try { DeviceInfo cashDrawer = GetActiveDeviceInfo(cashDrawerList, "CashDrawerName2", true); if (cashDrawer != null) { activeCashDrawer2 = (CashDrawer)explorer.CreateInstance(cashDrawer); activeCashDrawer2.Open(); activeCashDrawer2.Claim(1000); activeCashDrawer2.DeviceEnabled = true; } } catch (PosControlException) { // Log error and set the active to nil activeCashDrawer2 = null; Logger.Error("InitializePosDevices", Strings.InitializationException); } } }
public void OpenCashDrawer(bool IsWaited = false) { try { string strLogicalName = "CashDrawer"; //PosExplorerを生成します。 PosExplorer posExplorer = new PosExplorer(); DeviceInfo deviceInfo = null; deviceInfo = posExplorer.GetDevice(DeviceType.CashDrawer, strLogicalName); m_Drawer = (CashDrawer)posExplorer.CreateInstance(deviceInfo); try { // m_Drawer.DeviceEnabled = true; } catch { } m_Drawer.Open(); m_Drawer.Claim(1000); //デバイスを使用可能(動作できる状態)にします。 m_Drawer.DeviceEnabled = true; } catch (PosControlException) { } m_Drawer.OpenDrawer(); // ドロワーが開いている間、待ちます。 while (m_Drawer.DrawerOpened == false) { System.Threading.Thread.Sleep(100); } //開いてから10秒間経っても閉じられない場合はビープ音を断続的に鳴らします。 //このメソッドを実行すると、ドロワーが閉じられるまで処理が戻ってこないので注意してください。 if (IsWaited) { m_Drawer.WaitForDrawerClose(10000, 2000, 100, 1000); } try { CloseCashDrawer(); } catch { try { m_Drawer = null; } catch { } } }
public OPOSCashDrawerServer(string deviceName) { PosExplorer myPosExplorer = new PosExplorer(); DeviceCollection myDevices = myPosExplorer.GetDevices(DeviceType.CashDrawer); try { foreach (DeviceInfo devInfo in myDevices) { if (devInfo.ServiceObjectName == deviceName) { _cashDrawer = myPosExplorer.CreateInstance(devInfo) as CashDrawer; //open _cashDrawer.Open(); //claim the printer for use _cashDrawer.Claim(CLAIM_TIMEOUT_MS); //make sure it is enabled _cashDrawer.DeviceEnabled = true; } } if (_cashDrawer == null) { throw new Exception("No Cash Drawer Available!"); } } catch (Exception ex) { throw new Exception("No Cash Drawer Available!"); } }
public void OpenCashDrawer() { myCashDrawer.Open(); myCashDrawer.Claim(1000); myCashDrawer.DeviceEnabled = true; myCashDrawer.OpenDrawer(); myCashDrawer.DeviceEnabled = false; myCashDrawer.Release(); myCashDrawer.Close(); }
public void openCashDrawer2() { myCashDrawer.Open(); myCashDrawer.Claim(1000); myCashDrawer.DeviceEnabled = true; myCashDrawer.OpenDrawer(); myCashDrawer.DeviceEnabled = false; myCashDrawer.Release(); myCashDrawer.Close(); //myCashDrawer.CapStatus }
public ICashDrawer GetCashDrawer() { if (_drawer == null) { DeviceInfo drawerDeviceInfo = _exp.GetDevice("CashDrawer"); CashDrawer drawer = (CashDrawer)_exp.CreateInstance(drawerDeviceInfo); _drawer = new DrawerWrapper(drawer, _messageBus); drawer.Open(); } return(_drawer); }
public bool Open(DrawerFlag _flag, int _id, int _managerid, bool useterm = false, double _beginningterm = 0.0) { lock (this.syncRoot) { CashDrawer _drawer = null; if (TryGetDrawer(_flag, out _drawer, _id)) { return(_drawer.Open(time, _managerid, useterm, _beginningterm)); } return(false); } }
public void OpenCashDrawer() { try { myCashDrawer.Open(); myCashDrawer.Claim(1000); myCashDrawer.DeviceEnabled = true; myCashDrawer.OpenDrawer(); myCashDrawer.DeviceEnabled = false; myCashDrawer.Release(); myCashDrawer.Close(); } catch (Exception ex) { } }
private void InitCashDrawer() { //<<<step1>>>--Start //Use a Logical Device Name which has been set on the SetupPOS. string strLogicalName = "CashDrawer"; try { //Create PosExplorer PosExplorer posExplorer = new PosExplorer(); DeviceInfo deviceInfo = null; try { deviceInfo = posExplorer.GetDevice(DeviceType.CashDrawer, strLogicalName); m_Drawer = (CashDrawer)posExplorer.CreateInstance(deviceInfo); } catch (Exception) { //Nothing can be used. //ChangeButtonStatus(); return; } //Open the device //Use a Logical Device Name which has been set on the SetupPOS. m_Drawer.Open(); //Get the exclusive control right for the opened device. //Then the device is disable from other application. //m_Drawer.Claim(1000); //Enable the device. m_Drawer.DeviceEnabled = true; } catch (PosControlException) { //Nothing can be used. //Nothing can be used. //ChangeButtonStatus(); } //<<<step1>>>--End }
private void button1_Click(object sender, EventArgs e) { if (!Turno.shiftActive) { return; } DarkForm darkForm = new DarkForm(); Form_Login formLogin = new Form_Login(string.Format("Verificación De\nUsuario")); FormShiftAddMoney formShiftAddMoney = new FormShiftAddMoney(); darkForm.Show(); formLogin.ShowDialog(); Empleado empleado = new Empleado(formLogin.ID); if (formLogin.DialogResult == DialogResult.OK && empleado.isAdmin) { if (formShiftAddMoney.ShowDialog() == DialogResult.OK) { //<<< step1 >>> --Start //When outputting to a printer,a mouse cursor becomes like a hourglass. try { if (m_Drawer != null) { //Open the device //Use a Logical Device Name which has been set on the SetupPOS. m_Drawer.Open(); //Get the exclusive control right for the opened device. //Then the device is disable from other application. m_Drawer.Claim(1000); //Enable the device. m_Drawer.DeviceEnabled = true; //Open the drawer by using the "OpenDrawer" method. m_Drawer.OpenDrawer(); m_Drawer.DeviceEnabled = false; m_Drawer.Release(); m_Drawer.Close(); } else { useDefaultPrinter(); } } catch (Exception) { if (m_Drawer != null) { m_Drawer.Release(); m_Drawer.Close(); } useDefaultPrinter(); } //<<<step1>>>--End Turno.AddCashToDrawer(empleado.ID, formShiftAddMoney.cash, formShiftAddMoney.reason); MessageBox.Show("Se realizó correctamente"); this.setGroupBoxInfo(); } } else if (formLogin.DialogResult == DialogResult.OK && !empleado.isAdmin && formLogin.ID > -1) { MessageBox.Show("No tiene los permisos necesarios para realizar esta acción"); } darkForm.Close(); }
private void PayBtn_Click(object sender, EventArgs e) { if (this.PO.delivered) { FormPagar formPagar = new FormPagar(this.PO.total - this.PO.pay, true); DarkForm darkForm = new DarkForm(); darkForm.Show(); if (formPagar.ShowDialog() == DialogResult.OK) { this.PO.MakePayment(Convert.ToDouble(formPagar.Pay), this.CurrentEmployeeID); this.updateValues(); if (m_Drawer != null) { try { //Open the device //Use a Logical Device Name which has been set on the SetupPOS. m_Drawer.Open(); //Get the exclusive control right for the opened device. //Then the device is disable from other application. m_Drawer.Claim(1000); //Enable the device. m_Drawer.DeviceEnabled = true; //Open the drawer by using the "OpenDrawer" method. m_Drawer.OpenDrawer(); m_Drawer.DeviceEnabled = false; m_Drawer.Release(); m_Drawer.Close(); } catch (PosControlException) { useNativePrinter(); } } else { useNativePrinter(); } //<<<step1>>>--End MessageBox.Show("Se realizó abono con exito"); if (this.PO.paid) { if (inASearch) { searchPO(); } else { this.loadPurchases(); } } } darkForm.Close(); } else { MessageBox.Show("Primero debe confirmar el pedido para realizar un abono", "No se puede realizar un abono", MessageBoxButtons.OK); } }