Esempio n. 1
0
        // this will fill the DM Chat List Box with if there is a conversation
        // between active user and the receiver
        private void FillDMChatList()
        {
            // firstly, clear the list box
            lb_direct_message.Items.Clear();

            if (WorkHorse.DMChatList.Count > 0)
            {
                foreach (DirectMessage dm in WorkHorse.DMChatList)
                {
                    string sender  = dm.Fields.Sender;
                    string message = dm.Fields.Message;

                    // also block messages in DM if a user blocked the sender
                    if (WorkHorse.IsBlocked(MainUser.UserName, sender))
                    {
                        message = "*** blocked ***";
                    }

                    lb_direct_message.Items.Add(sender + ": " + message);
                }
            }
        }
Esempio n. 2
0
        private void FillChatBox(string location, List <Chat> chatList)
        {
            if (location.Equals("chat"))
            {
                lb_chat.Items.Clear();
            }

            if (location.Equals("search"))
            {
                lb_search.Items.Clear();
            }

            if (WorkHorse.ChatList.Count > 0)
            {
                foreach (var chat in chatList)
                {
                    string sender  = chat.Fields.Username;
                    string message = chat.Fields.Message;

                    // check if the sender is blocked, if so; block the message
                    if (WorkHorse.IsBlocked(MainUser.UserName, sender))
                    {
                        message = "*** blocked ***";
                    }

                    if (location.Equals("chat"))
                    {
                        lb_chat.Items.Add(sender + ": " + message);
                    }

                    if (location.Equals("search"))
                    {
                        lb_search.Items.Add(sender + ": " + message);
                    }
                }
            }
        }