This class is used to acquire a human readable string of the current errors/warnings stored in a
PrinterStatus instance
Namespace:
ZSDK_API.PrinterAssembly: ZSDK_API (in ZSDK_API.dll) Version: 1.1.123.0
Syntax
C# |
---|
public class PrinterStatusMessages |
Visual Basic (Declaration) |
---|
Public Class PrinterStatusMessages |
Examples
Get a string array of the current errors and warnings
CopyC#
using System; using ZSDK_API.Comm; using ZSDK_API.ApiException; using ZSDK_API.Printer; try { TcpPrinterConnection zebraPrinterConnection = new TcpPrinterConnection("192.168.1.100", TcpPrinterConnection.DEFAULT_ZPL_TCP_PORT); zebraPrinterConnection.Open(); ZebraPrinter printer = ZebraPrinterFactory.GetInstance(zebraPrinterConnection); PrinterStatus printerStatus = printer.GetCurrentStatus(); String status; if (printerStatus.IsReadyToPrint) { status = "Ready To Print"; } else { PrinterStatusMessages statusMessage = new PrinterStatusMessages(printerStatus); String[] statusMessages = statusMessage.GetStatusMessage(); String joinedStatusMessage = ""; for (int i = 0; i < statusMessages.Length; i++) { joinedStatusMessage += statusMessages[i] + ";"; } status = "Cannot Print: " + joinedStatusMessage; } } catch (ZebraPrinterConnectionException e) { Console.Write(e.Message); } catch (ZebraPrinterLanguageUnknownException e) { Console.Write(e.Message); }
CopyVB.NET
Imports System Imports System.Threading Imports ZSDK_API.Comm Imports ZSDK_API.ApiException Imports System.Text Imports System.IO.Ports Imports ZSDK_API.Printer Imports System.Collections.Generic Try Dim zebraPrinterConnection As New TcpPrinterConnection("192.168.1.100", TcpPrinterConnection.DEFAULT_ZPL_TCP_PORT) zebraPrinterConnection.Open() Dim printer As ZebraPrinter = ZebraPrinterFactory.GetInstance(zebraPrinterConnection) Dim printerStatus As PrinterStatus = printer.GetCurrentStatus() Dim status As [String] If printerStatus.IsReadyToPrint Then status = "Ready To Print" Else Dim statusMessage As New PrinterStatusMessages(printerStatus) Dim statusMessages As [String]() = statusMessage.GetStatusMessage() Dim joinedStatusMessage As [String] = "" For i As Integer = 0 To statusMessages.Length - 1 joinedStatusMessage += statusMessages(i) & ";" Next status = "Cannot Print: " & joinedStatusMessage End If Catch e As ZebraPrinterConnectionException Console.Write(e.Message) Catch e As ZebraPrinterLanguageUnknownException Console.Write(e.Message) End Try