Pop3Wait Method (Int32)

Note: This API is now obsolete.

Waits the completion of the currently running (if any) asynchronous method for the specified amount of time.

Namespace: MailBee.Pop3Mail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax
[ObsoleteAttribute("This method is obsolete in .NET 4.5+.")]
public bool Wait(
	int timeoutInterval
)

Parameters

timeoutInterval
Type: SystemInt32
The amount of time (in milliseconds) the method will wait completion of the currently running asynchronous method before returning false.

Return Value

Type: Boolean
true if the asynchronous method has finished execution during the specified amount of time, false if it's still running.
Exceptions
Remarks
Note Note
.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.
Caution note Caution
RaiseEventsViaMessageLoop property 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.
Note Note
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(String, Int32, Boolean, AsyncCallback, Object) method for examples.
Another alternative (in WinForms application) to using Wait method is to never block the application message loop. See BeginExecuteCustomCommand(String, Boolean, AsyncCallback, Object) method for the code example.
Note Note
In many cases, it's easier not to use events at all but derive a new class from Pop3 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