public async Task Handle(NewMailReceived message, IMessageHandlerContext context)
        {
            var attachmentStream = GetStreamForAttachment(message.ExchangeMailId);

            this.Data.TotalBytes = attachmentStream.Value;

            await context.Send(new DownloadFileChunk { ExchangeMailId = message.ExchangeMailId, StartChunkBytes = 0, EndChunkBytes = 32767 }).ConfigureAwait(false);

            await RequestTimeout <CheckDownloadState>(context, TimeSpan.FromHours(1));
        }
Exemple #2
0
        private async Task UpdateMailsAsync(string checkResponse)
        {
            var newMailsIds = Parser.GetMailsIds(checkResponse).Where(IsNewMail);
            var newMails    = await GetMailsAsync(newMailsIds);

            Mails.AddRange(newMails);

            foreach (var mail in newMails)
            {
                NewMailReceived?.Invoke(this, new NewMailReceivedEventArgs(mail));
            }
        }