コード例 #1
0
        /*
         * 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!";
        }
コード例 #2
0
 public void Connect()
 {
     usbPrinter = UsbDiscoverer.GetZebraUsbPrinters(new ZebraPrinterFilter()).FirstOrDefault();
     if (usbPrinter == null)
     {
         throw new ArgumentException("Принтер не найден!");
     }
     connection = usbPrinter.GetConnection();
     Connected  = true;
 }