Public Class ExtraWork
Implements
Pronexus.VBVoice.IVBVRunnable
Public Function
run(ByVal jobID As Integer, ByRef data As Pronexus.VBVoice.VBVJobData) As
Pronexus.VBVoice.Run Implements Pronexus.VBVoice.IVBVRunnable.run
System.Threading.Thread.Sleep(New
TimeSpan(0, 0, 30))
Return
Nothing
End Function
End Class
Private Sub WorkerThread1_EnterEvent(ByVal sender As System.Object, ByVal
e As AxVBVoiceLib._WorkerThreadEvents_EnterEvent) Handles
WorkerThread1.EnterEvent
e.jobObject = New
ExtraWork()
End Sub
Private Sub WorkerThread1_Exit(ByVal sender
As Object, ByVal e As AxVBVoiceLib._WorkerThreadEvents_ExitEvent) Handles
WorkerThread1.Exit
If e.jobData.complete Then
' Job is done
End
If
End Sub
As shown above, in the EnterEvent event a new instance of our class is instantiated, where the IVBVRunnable interface is implemented. Then this is assigned to the e.jobObject provided with the event arguments. A new class that is derived from the VBVJobData object can also be instantiated and assigned to e.jobData if the goal is to pass data to the thread or back from the thread, or otherwise a default object (VBVJobData) will be used that has basic properties.
JobData will eventually be passed back in the Exit event arguments and will also be saved to the control as a runtime channelized property.