public void RefreshMessageList() { PushSelectedIndex(); List <MessageEntry> messageEntries = _messageRepository.LoadMessages() .ToList(); List <MimeMessageEntry> toAdd = messageEntries.Except(Messages) .Select(m => new MimeMessageEntry(m, _mimeMessageLoader)) .ToList(); List <MimeMessageEntry> toDelete = Messages.Except(messageEntries).OfType <MimeMessageEntry>().ToList(); toDelete.ForEach(m => Messages.Remove(m)); Messages.AddRange(toAdd); MessagesSorted.Refresh(); ValidateSelected(); PopSelectedIndex(); }
int?GetIndexOfMessage(MessageEntry entry) { if (entry == null) { throw new ArgumentNullException(nameof(entry)); } int index = MessagesSorted.OfType <MessageEntry>().FindIndex(m => Equals(entry, m)); return(index == -1 ? null : (int?)index); }
int?GetIndexOfMessage([CanBeNull] MessageEntry entry) { if (entry == null) { return(null); } int index = MessagesSorted.OfType <MessageEntry>().FindIndex(m => Equals(entry, m)); return(index == -1 ? null : (int?)index); }
MimeMessageEntry GetMessageByIndex(int index) { return(MessagesSorted.OfType <MimeMessageEntry>().Skip(index).FirstOrDefault()); }