public void OnRemoveMessage(Message message) { var item = Messages.Find(x => x.Text == message.Text && x.ReceivingTime == message.ReceivingTime && x.User == message.User); if (item != null) { Messages.Remove(item); } if (Messages.Count(t => t.User == message.User) == 1) { UniqueUsers.Remove(message.User); } }
public void OnAddMessage(Message message) { Messages.Add(message); CountMessages++; Messages[Messages.Count - 1].ReferenceNumber = CountMessages; message.FormatText = FormatText(message).FormatText; if (!UniqueUsers.Contains(message.User)) { UniqueUsers.Add(message.User); } var handler = SmsAdded; handler?.Invoke(Messages[Messages.Count - 1]); }