Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET IMAP

 AfterLogic Forum : MailBee.NET IMAP
Subject Topic: Async Sample Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
glose
Newbie
Newbie


Joined: 29 August 2011
Location: United States
Online Status: Offline
Posts: 1
Posted: 29 August 2011 at 8:38am | IP Logged Quote glose

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 View glose's Profile Search for other posts by glose
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 29 August 2011 at 8:46am | IP Logged Quote Igor

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 View Igor's Profile Search for other posts by Igor
 
larsk
Newbie
Newbie


Joined: 26 October 2011
Online Status: Offline
Posts: 2
Posted: 26 October 2011 at 10:24pm | IP Logged Quote larsk


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 View larsk's Profile Search for other posts by larsk
 
larsk
Newbie
Newbie


Joined: 26 October 2011
Online Status: Offline
Posts: 2
Posted: 27 October 2011 at 12:10am | IP Logged Quote larsk

Correction the my code was based on http://ru.afterlogic.com
Back to Top View larsk's Profile Search for other posts by larsk
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 27 October 2011 at 3:22am | IP Logged Quote Igor

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 View Igor's Profile Search for other posts by Igor
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide