Using the Events OnStatus, OnPrinterReport, and OnPrintJobReport Example for VB.NET

Private WithEvents objPrintSCU As LTDICPRNSCULib.LEADDicomPrintSCU
Private Sub objPrintSCU_OnStatus(ByVal Status As LTDICPRNSCULib.PrintScuStatusEnum, ByVal OperationStatus As Integer)
   Dim sStatusCodeType As String
   Dim sOpStatus As String
   Select Case Status
   Case LTDICPRNSCULib.PrintScuStatusEnum.PRNSCU_STATUS_RECEIVE_ABORT
      MessageBox.Show("Source = " & objPrintSCU.AbortSource & ", " & "Reason = " & objPrintSCU.AbortReason, "Print SCP Aborted the Association")
   Case LTDICPRNSCULib.PrintScuStatusEnum.PRNSCU_STATUS_RECEIVE_PRINT_FILM_SESSION_RSP
      If OperationStatus = LTDNCLib.DicomCommandStatusConstants.COMMAND_STATUS_SUCCESS Then
         If objPrintSCU.LastOperationStatus = LTDNCLib.DicomCommandStatusConstants.COMMAND_STATUS_SUCCESS Then
            sStatusCodeType = "Success"
         Else
            sStatusCodeType = "Warning"
         End If Else sStatusCodeType = "Failure"
      End If
      sOpStatus = Hex(objPrintSCU.LastOperationStatus)
      Do While Len(sOpStatus) < 4
         sOpStatus = "0" & sOpStatus
      Loop
      sOpStatus = "0x" & sOpStatus
      MessageBox.Show("Status: " & sOpStatus & " (" & sStatusCodeType & ")", "Received N-ACTION-RSP (Basic Film Session SOP Class)")
   End Select
End Sub
 

Private Sub objPrintSCU_OnPrinterReport(ByVal EventTypeID As Short, ByVal PrinterStatusInfo As String, ByVal FilmDestination As String, ByVal PrinterName As String)
   Dim sEventTypeName As String
   sEventTypeName = "Normal"
   Select Case EventTypeID
      Case 2
         sEventTypeName = "Warning"
      Case 3
         sEventTypeName = "Failure"
      End Select
      Dim sMsg As String
      sMsg = "Event Type Name: " & sEventTypeName
      If EventTypeID <> 1 Then
         sMsg = sMsg & vbNewLine & "Printer Status Info: " & PrinterStatusInfo & vbNewLine & "Film Destination: " & FilmDestination & vbNewLine & "Printer Name: " & PrinterName
      End If
      MessageBox.Show(sMsg, "Printer Status Report")
End Sub

Private Sub objPrintSCU_OnPrintJobReport(ByVal PrintJobSOPInstanceUID As String, ByVal EventTypeID As Short, ByVal ExecutionStatusInfo As String, ByVal PrintJobID As String, ByVal FilmSessionLabel As String, ByVal PrinterName As String)
   Dim sEventTypeName As String
   sEventTypeName = "Pending"
   Select Case EventTypeID
      Case 2
         sEventTypeName = "Printing"
      Case 3 sEventTypeName = "Done"
      Case 4 sEventTypeName = "Failure"
   End Select

   MessageBox.Show("Print Job SOP Instance UID: " & PrintJobSOPInstanceUID & vbNewLine & "Event Type Name: " & sEventTypeName & vbNewLine & "Execution Status Info: " & ExecutionStatusInfo & vbNewLine & "Film Session Label: " & FilmSessionLabel & vbNewLine & "Printer Name: " & PrinterName, "Print Job Status Report")
End Sub