Note: This API is now obsolete.
Waits the completion of the currently running (if any) asynchronous method
for the specified amount of time.
MailBee.NET (in MailBee.NET.dll) Version: 12.2.0 build 630 for .NET 4.5
[ObsoleteAttribute("This method is obsolete in .NET 4.5+.")]
public bool Wait(
<ObsoleteAttribute("This method is obsolete in .NET 4.5+.")>
Public Function Wait (
timeoutInterval As Integer
) As Boolean
- Type: SystemInt32
The amount of time (in milliseconds) the method will wait
completion of the currently running asynchronous method before returning false.
if the asynchronous method has finished execution during the specified
amount of time, false
if it's still running.
|.NET 4.5+ apps should use XXXAsync methods which can be awaited. The current method is suitable for BeginXXX/EndXXX methods only which
are now deprecated.|
This method should only be used in WinForms applications in the scenarios when the application message loop
is blocked and events raised by asynchronous methods get no chance to be processed.
must be set to false prior to using this method. This is required in order
to switch event marshalling mechanism from sending events to the application message loop
to the internal thread-independent event processor.|
Usually, when the developer wants to use asynchronous methods which might raise events
in a WinForm application,
it's not possible to use methods like WaitOne(Int32, Boolean)
since they would block the message loop and thus prevent events (which are raised
on the message loop thread) from getting processed. Wait
method provides an alternative
approach which addresses the problem.
|The developer can also use this method with timeoutInterval set to 0 in
order to process currently pending MailBee events. This is useful if some lengthy work
is performed on the message loop thread, and the developer wants to periodically
let MailBee events get processed and then continue the lengthy work without waiting
for the completion of the asynchronous method. See BeginConnect(AsyncCallback, Object) method
Another alternative (in WinForms application) to using Wait
is to never block the application message loop and use callback functions instead of
waiting for asynchronous method completion.
|In many cases, it's easier not to use events at all but derive a new class from
Smtp class and override corresponding OnEventName method in order
to get the developer-supplied code executed. See OnConnected(ConnectedEventArgs) method
documentation for more information.|See Also