Waiting Methods |
Top Previous Next |
There are several waiting methods that allow to wait for specifics events or event sequence, blocking the code execution until the event is raised or the operation times out. Main methods are:
VB.NET [Boolean] = tnxxxx.WaitForConnect ([TimeOut As Integer]) [Boolean] = tnxxxx.WaitForScreen ([TimeOut As Integer]) [Boolean] = tnxxxx.WaitForUnlock ([TimeOut As Integer]) [Boolean] = tnxxxx.WaitFor (StrValue As String, [TimeOut As Integer]) [Integer] = tnxxxx.WaitFor (StrValues As Array of String, [TimeOut As Integer])
C# [bool] = tnxxxx.WaitForConnect ([int TimeOut]); [bool] = tnxxxx.WaitForScreen ([int TimeOut]); [bool] = tnxxxx.WaitForUnlock ([int TimeOut]); [bool] = tnxxxx.WaitFor (string StrValue, [int TimeOut]); [int] = tnxxxx.WaitFor (string[] StrValues, [int TimeOut]);
WaitForConnect waits until the telnet connection is successfully established. WaitForScreen waits until a new screen arrives after the connection is established or an AID key was sent. WaitForUnlock waits until the host system turns to an unlocked state. WaitFor waits for a screen containing the specified string or strings.
The following graphic shows the sequence of actions corresponding to the WaitFor method:
Examples
VB.NET: Private Sub cmdGetInfo_Click(eventSender As object, eventArgs As System.EventArgs) tn3270.Host = Edit1.Text If (tn3270.Connect(10000) Then tn3270.Type("Anonymous") tn3270.PressAndWait("ENTER") tn3270.Type("srch "+Edit2.Text+"@E") tn3270.WaitFor("Library") Edit3.Text = tn3270.GetText(20,5,30) tn3270.Disconnect() End If End Sub
C#: private void cmdGetInfo_Click(object eventSender, System.EventArgs eventArgs) { tn3270.Host = Edit1.Text; if (tn3270.Connect(10000)) { tn3270.Type("Anonymous"); tn3270.PressAndWait("ENTER"); tn3270.Type("srch "+Edit2.Text+"@E"); tn3270.WaitFor("Library"); Edit3.Text = tn3270.GetText(20,5,30); tn3270.Disconnect(); } }
|