public void Open() { // posExplorer = new PosExplorer(); // control = new OPOSPOSPrinterClass();//new jpos.POSPrinter (); try { //device = posExplorer.GetDevice(DeviceType.PosPrinter ,this.deviceName ); //Logger.Info("PosPrinterWrapper.cs", device.Description, Settings.Instance.Debug); //posPrinter = (Microsoft.PointOfService.PosPrinter) posExplorer.CreateInstance(device); posPrinter.Open(); posPrinter.Claim(1000); posPrinter.DeviceEnabled = true; deviceText = posPrinter.DeviceDescription; statusText = posPrinter.State.ToString(); string healthText = posPrinter.CheckHealth(HealthCheckLevel.Internal); Logger.Info("PosPrinterWrapper.cs", "CheckHealthText INTERNAL : " + healthText, PosSettings.Default.Debug); status = PosPrinterStatus.Active; this.RaiseStatusChangedEvent(); } catch (PosControlException e1) { //MessageBox.Show("ex1" + e1.ToString() ); Logger.Error("PosPrinterWrapper.cs", e1.ToString()); status = PosPrinterStatus.Inactive; this.RaiseStatusChangedEvent(); } catch (Exception e2) { // MessageBox.Show("Ex2" + e2.ToString() ); Logger.Error("PosPrinterWrapper.cs", e2.ToString()); status = PosPrinterStatus.Inactive; this.RaiseStatusChangedEvent(); } }
private void InitPrinter() { if (_printer.State == ControlState.Closed) { _printer.Open(); } if (!_printer.Claimed) { _printer.Claim(0); } if (!_printer.DeviceEnabled) { _printer.DeviceEnabled = true; } if (!_printer.RecLetterQuality) { // If true, prints in high-quality mode. If false, prints in high-speed mode _printer.RecLetterQuality = true; } }