public short ReadAndPrint(string productBin, ICardPrintDetails cardPrintDetails, out IDeviceMagData magData) { throw new NotImplementedException(); }
public short ReadAndPrint(string productBin, ICardPrintDetails cardPrintDetails, out IDeviceMagData magData) { RaiseDeviceNotification("Call to ReadAndPrint()", false, EventArgs.Empty); magData = null; System.Threading.Thread.Sleep(3000); ExtractDetails(productBin, cardPrintDetails); return(PrinterCodes.Success); }
public short ReadAndPrint(string productBin, ICardPrintDetails cardPrintDetails, out IDeviceMagData magData) { magData = null; if (cardPrintDetails == null) { throw new Exception("No printing data available to print to card."); } if (!HasMagEncoder()) { throw new Exception("Device does not have a Magstripe encoder installed."); } string status; List <IDeviceErrorDescriptor> errors; if (CheckPrinterStatus(out status, out errors)) { try { // Set the card destination to 'Hold' after we have read the mag stripe _zebraCardPrinter.SetJobSettings(new Dictionary <string, string> { { ZebraCardJobSettingNames.CARD_SOURCE, _cardSource.ToString() }, { ZebraCardJobSettingNames.CARD_DESTINATION, CardDestination.Hold.ToString() } }); // Set the card source to 'Internal' and destination to 'Eject' _currentPrintJob = PositionAndPrint(cardPrintDetails, new Dictionary <string, string> { { ZebraCardJobSettingNames.CARD_SOURCE, CardSource.Internal.ToString() }, { ZebraCardJobSettingNames.CARD_DESTINATION, CardDestination.Eject.ToString() } }); ZebraMagData deviceMagData = new ZebraMagData(_zebraCardPrinter.ReadMagData(DataSource.Track1 | DataSource.Track2 | DataSource.Track3)); // Check that product matches BIN if (!deviceMagData.TrackDataToString(2).StartsWith(productBin)) { return(PrinterCodes.ProductBinAndCardMismatch); } var pollJobTask = PollJobStatusAsync(); magData = deviceMagData; // Poll job status if (_currentPrintJob != -99) { pollJobTask.Wait(); // _zebraCardPrinter.EjectCard(); return(pollJobTask.Result); } return(PrinterCodes.Success); } catch { _zebraCardPrinter.EjectCard(); throw; } } throw new Exception("Printer in failed state."); }