public void AddMessage(Message message) { var allUserMessages = GetUserMessages(message.UserUniqueName); if (allUserMessages.Count == User.GetMessageCountToShow()) { allUserMessages.Sort(delegate(Message a, Message b) { return(a.AddDateTime.CompareTo(b.AddDateTime)); }); messages.Remove(allUserMessages.First()); } messages.Add(message); XmlStorage.SaveChanges(); }
static XmlStorage() { XmlStorage.GetDataFromStorage(); }