Changeset 1279
- Timestamp:
- 1/31/2010 4:41:08 AM (6 weeks ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
EveHQ.Core/EveMail.vb (modified) (11 diffs)
-
EveHQ/Forms/frmMail.vb (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/EveHQ.Core/EveMail.vb
r1278 r1279 7 7 Dim MailTimeFormat As String = "yyyy-MM-dd HH:mm:ss" 8 8 Dim culture As System.Globalization.CultureInfo = New System.Globalization.CultureInfo("en-GB") 9 10 Public Event MailProgress(ByVal Status As String) 9 11 10 12 Public Sub GetMail() … … 30 32 Dim mAccount As EveHQ.Core.EveAccount = CType(EveHQ.Core.HQ.EveHQSettings.Accounts.Item(accountName), Core.EveAccount) 31 33 ' Add in the data for mailing lists 34 RaiseEvent MailProgress("Processing Mailing Lists for " & mPilot.Name & "...") 32 35 Call EveHQ.Core.DataFunctions.WriteMailingListIDsToDatabase(mPilot) 33 36 ' Make a call to the EveHQ.Core.API to fetch the EveMail 37 RaiseEvent MailProgress("Fetching EveMails for " & mPilot.Name & "...") 34 38 Dim mailXML As New XmlDocument 35 39 mailXML = EveHQ.Core.EveAPI.GetAPIXML(EveHQ.Core.EveAPI.APIRequest.MailMessages, mAccount, mPilot.ID, EveHQ.Core.EveAPI.APIReturnMethod.ReturnStandard) … … 74 78 75 79 ' Stage 3: Check the messages which have already been posted 80 RaiseEvent MailProgress("Checking for new EveMails for all characters...") 76 81 Dim existingMails As New ArrayList 77 82 Dim strExistingMails As New StringBuilder … … 93 98 94 99 ' Stage 4: Post all new messages to the database 100 RaiseEvent MailProgress("Posting new EveMails to the database...") 95 101 Dim NewMails As New ArrayList 96 102 Dim strInsert As String = "INSERT INTO eveMail (messageKey, messageID, originatorID, senderID, sentDate, title, toCorpOrAllianceID, toCharacterIDs, toListIDs, readMail) VALUES " … … 128 134 129 135 ' Stage 5: Get all the IDs and parse them 136 RaiseEvent MailProgress("Posting EveMail IDs to the database...") 130 137 Dim IDs As New ArrayList 131 138 For Each cMail As EveHQ.Core.EveMailMessage In Mails.Values … … 143 150 ' Add in the Mailing List IDs 144 151 For Each cMail As EveHQ.Core.EveMailMessage In Mails.Values 145 EveHQ.Core.DataFunctions.ParseIDs(IDs, cMail.To CorpAllianceIDs)152 EveHQ.Core.DataFunctions.ParseIDs(IDs, cMail.ToListIDs) 146 153 Next 147 154 148 155 ' Send E-mail notification of new mails if required 149 156 If EveHQ.Core.HQ.EveHQSettings.NotifyEveMail = True And NewMails.Count > 0 Then 157 RaiseEvent MailProgress("Sending notification of new mails...") 150 158 Call SendEmailForNewEveMails(NewMails, IDs) 151 159 End If … … 174 182 Dim mAccount As EveHQ.Core.EveAccount = CType(EveHQ.Core.HQ.EveHQSettings.Accounts.Item(accountName), Core.EveAccount) 175 183 ' Make a call to the EveHQ.Core.API to fetch the EveMail 184 RaiseEvent MailProgress("Fetching Eve Notifications for " & mPilot.Name & "...") 176 185 Dim mailXML As New XmlDocument 177 186 mailXML = EveHQ.Core.EveAPI.GetAPIXML(EveHQ.Core.EveAPI.APIRequest.Notifications, mAccount, mPilot.ID, EveHQ.Core.EveAPI.APIReturnMethod.ReturnStandard) … … 213 222 214 223 ' Stage 3: Check the messages which have already been posted 224 RaiseEvent MailProgress("Checking for new Eve Notifications for all characters...") 215 225 Dim existingMails As New ArrayList 216 226 Dim strExistingMails As New StringBuilder … … 232 242 233 243 ' Stage 4: Post all new messages to the database 244 RaiseEvent MailProgress("Posting new Eve Notifications to the database...") 234 245 Dim newNotifys As New ArrayList 235 246 Dim strInsert As String = "INSERT INTO eveNotifications (messageKey, messageID, originatorID, senderID, typeID, sentDate, readMail) VALUES " … … 265 276 266 277 ' Stage 5: Get all the IDs and parse them 278 RaiseEvent MailProgress("Posting Eve Notification IDs to the database...") 267 279 Dim IDs As New ArrayList 268 280 For Each cNotice As EveHQ.Core.EveNotification In Notices.Values … … 276 288 ' Send E-mail notification of new mails if required 277 289 If EveHQ.Core.HQ.EveHQSettings.NotifyEveMail = True And newNotifys.Count > 0 Then 290 RaiseEvent MailProgress("Sending notification of new notices...") 278 291 Call SendEmailForNewEveNotifications(newNotifys, IDs) 279 292 End If -
trunk/EveHQ/Forms/frmMail.vb
r1278 r1279 7 7 Dim displayPilot As New EveHQ.Core.Pilot 8 8 Dim cDisplayPilotName As String = "" 9 Dim mailStatus As String = "" 9 10 10 11 Public Property DisplayPilotName() As String … … 76 77 77 78 Private Sub btnDownloadMail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDownloadMail.Click 78 79 Me.Cursor = Cursors.WaitCursor 80 79 Threading.ThreadPool.QueueUserWorkItem(AddressOf MailUpdateThread) 80 End Sub 81 82 Private Sub MailUpdateThread(ByVal state As Object) 81 83 Dim myMail As New EveHQ.Core.EveMail 84 AddHandler myMail.MailProgress, AddressOf DisplayMailProgress 85 btnDownloadMail.Enabled = False 82 86 Call myMail.GetMail() 83 87 Me.Invoke(New MethodInvoker(AddressOf MailUpdateCompleted)) 88 End Sub 89 90 Private Sub DisplayMailProgress(ByVal Status As String) 91 mailStatus = Status 92 Me.Invoke(New MethodInvoker(AddressOf UpdateMailProgress)) 93 End Sub 94 95 Private Sub UpdateMailProgress() 96 lblDownloadMailStatus.Text = mailStatus 97 End Sub 98 99 Private Sub MailUpdateCompleted() 84 100 ' Update the display with EveMail 85 101 Call Me.UpdateMailInfo() 86 87 Me.Cursor = Cursors.Default 88 102 lblDownloadMailStatus.Text = "Mail Processing Complete!" 103 btnDownloadMail.Enabled = True 89 104 Call frmEveHQ.UpdateEveMailButton() 90 91 105 End Sub 92 106 … … 273 287 End Sub 274 288 275 289 276 290 End Class 277 291
