.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

RaiseEventsViaMessageLoop property
must be set to false prior to using this method. This is required in order
to switch event marshaling 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

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, Socket, EndPoint, AsyncCallback, Object) method
for examples.

In many cases, it's easier not to use events at all but derive a new class from
Imap class and override corresponding OnEventName method in order
to get the developer-supplied code executed. See OnConnected(ConnectedEventArgs) method
documentation for more information.