Beispiel #1
0
        public List <string> getUserMessages()
        {
            List <string> messages = new List <string>();

            if (MessageList.Count > 0)
            {
                foreach (Message message in MessageList)
                {
                    messages.Add($"   {message.MessageText} {TimeFormatter.TimeAgo(message.Timestamp)}");
                }
            }
            else
            {
                messages.Add($"{Username} has not posted any messages");
            }
            return(messages);
        }
Beispiel #2
0
        public List <string> getWall()
        {
            List <WallEntry> tempWall   = new List <WallEntry>();
            List <string>    stringList = new List <string>();

            if (MessageList.Count != 0 && MessageList != null)
            {
                foreach (Message msg in MessageList)
                {
                    tempWall.Add(new WallEntry(Username, msg));
                }
            }
            if (FollowList != null)
            {
                foreach (User user in FollowList)
                {
                    foreach (Message msg in user.MessageList)
                    {
                        tempWall.Add(new WallEntry(user.Username, msg));
                    }
                }
            }
            tempWall.Sort((a, b) => b.WallMessage.Timestamp.CompareTo(a.WallMessage.Timestamp));
            foreach (WallEntry entry in tempWall)
            {
                stringList.Add($"   {entry.WallName} - {entry.WallMessage.MessageText} {TimeFormatter.TimeAgo(entry.WallMessage.Timestamp)}");
            }
            return(stringList);
        }