0 votes

I am a bit confused by the example you have posted showing how to stop imap idle from the console by starting a thread. I would like to stop idle when the user clicks a button on a form. Can you post a short example, preferably in vb.net, showing how this could be done? Thank you.

by
retagged by

1 Answer

+1 vote
 
Best answer

Imap.Idle method blocks current thread. In Console example this is the main thread of the app, that's why Imap.StopIdle is invoked from a separate thread).

To stop Idle method you need to invoke Imap.StopIdle method. StopIdle method is thread-safe.

In most scenarios you'll run Idle method on a separate/background thread, in order not to block the main/UI thread.

In such case you can simply invoke StopIdle from the UI thread.

by (297k points)
selected by
...