void AddNewMessage(MessageEntry entry) { var observable = _mimeMessageLoader.GetObservable(entry); observable.ObserveOnDispatcher().Subscribe( message => { this._messageBus.Publish( new ShowBallonTip( 3500, "New Message Received", $"From: {message.From.ToString().Truncate(50)}\r\nSubject: {message.Subject.Truncate(50)}", ToolTipIcon.Info)); // Add it to the list box ClearSelected(); PopSelectedIndex(); entry.IsSelected = true; Messages.Add(new MimeMessageEntry(entry, _mimeMessageLoader)); }, e => { // NOOP }); }
public MimeMessageEntry(MessageEntry entry, MimeMessageLoader loader) : base(entry.File) { IsSelected = entry.IsSelected; loader.GetObservable(this).Subscribe(m => { Subject = m.Subject; Priority = m.Priority; AttachmentsCount = m.Attachments.Count(); }, e => { Subject = $"Failure loading message: {e.Message}"; }); }