/* * Connect to a printer using the Zebra API */ private void ConnectToPrinter() { DiscoveredUsbPrinter discoveredPrinter = UsbDiscoverer.GetZebraUsbPrinters(new ZebraPrinterFilter())[0]; Connection connection = discoveredPrinter.GetConnection(); connection.Open(); printer = ZebraPrinterFactory.GetInstance(connection); ConnectionLabel.Text = "Printer Connected!"; }
public void Connect() { usbPrinter = UsbDiscoverer.GetZebraUsbPrinters(new ZebraPrinterFilter()).FirstOrDefault(); if (usbPrinter == null) { throw new ArgumentException("Принтер не найден!"); } connection = usbPrinter.GetConnection(); Connected = true; }