Author |
|
glose Newbie
Joined: 29 August 2011 Location: United States
Online Status: Offline Posts: 1
|
Posted: 29 August 2011 at 8:38am | IP Logged
|
|
|
Hello All -
Attempting to utilize the IMAP components through the async methods. The examples provided with the software seem to not really utilize threading or at least don't really use callbacks.
What I need to learn how to do is to make a call, pass in a callback and then when the callback is executed send an event on the same thread as the GUI - right now when I fire the event it appears to be on the same thread as the async call.
Tx for the help.
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 29 August 2011 at 8:46am | IP Logged
|
|
|
Under Start > MailBee.NET Objects > Sample Applications > WinForms 2.0 menu folder, you'll find a number of samples for C# and VB, and every "... Demo 2" entry there uses asynchronous approach. I guess it should provide a decent starting point, and if you have questions regarding particular usage aspects, you can check that in documentation or ask us of course.
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|
larsk Newbie
Joined: 26 October 2011
Online Status: Offline Posts: 2
|
Posted: 26 October 2011 at 10:24pm | IP Logged
|
|
|
I have used your sample Async Idle demo2
This works very nicely/fine,
Question 1
However what is the proper way to recovering from connections errors? As connection errors are luckily quite rare is this the right way to recover?
Sub Start
... connection code etc etc..
' Attach event handlers.
AddHandler myImapIdle.Idling, AddressOf myImapIdle_Idling
AddHandler myImapIdle.MessageStatus, AddressOf myImapIdle_MessageStatus
Try
myImapIdle.Idle()
Catch ex As Exception
StopImapIdle()
myImapIdle = Nothing
Finally
myImapIdle = Nothing
End Try
end sub
Public Sub StopImapIdle()
If Not myImapIdle Is Nothing And myImapIdle.IsBusy Then
myImapIdle.StopIdle()
End If
End Sub
To Restart idle, I presently have a timer1 function that checks the last Idle command, accordingly to the result restarts idle-
Question 2
in my
Private Sub myImapIdle_MessageStatus(ByVal sender As Object, ByVal e As ImapMessageStatusEventArgs)
ImapStatusIdStr = e.StatusID.ToUpper
imapCountFreshUpdated = e.MessageCountOrIndex
etc etc
end sub
I get the Number of Messages in the Folder from e.MessageCountOrIndex, how do I get the index instead. (I am using Gmail)
Thanks in advance
|
Back to Top |
|
|
larsk Newbie
Joined: 26 October 2011
Online Status: Offline Posts: 2
|
Posted: 27 October 2011 at 12:10am | IP Logged
|
|
|
Correction the my code was based on http://ru.afterlogic.com
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 27 October 2011 at 3:22am | IP Logged
|
|
|
1) StopIdle method call does not affect connection status, it just stops idling itself. Thus, you might want to use IsConnected property and Disconnect/Connect methods, to monitor and change connection status.
2) GMail provides highly non-standard IMAP behavior, and it doesn't provide full support for flags like RECENT. When you get alert from IDLE about new messages, you'll need to stop idling and start locating that particular message.
Please note this is a community resource and if you require assistance from AfterLogic Team, it is recommended to use HelpDesk instead.
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|