Beispiel #1
0
        private void timer_Tick(object sender, EventArgs e)
        {
            Server.Service1 server = new Server.Service1();
            server.setConnected(lbl_me.Text, true, true);
            List <string> messagesList = new List <string>();

            string[] messagesArray = messagesList.ToArray();
            server.getGroupChatText(lbl_me.Text, ref messagesArray);

            foreach (string message in messagesArray)
            {
                string actualMessage = "";
                string userName      = "";
                bool   flipFlag      = false;

                foreach (char chr in message)
                {
                    if (flipFlag)
                    {
                        userName += chr;
                    }
                    if (chr == '^')
                    {
                        flipFlag = true;
                    }
                    if (!flipFlag)
                    {
                        actualMessage += chr;
                    }
                }

                msg n = new msg(actualMessage, userName);
                flowLayoutPanel1.Controls.Add(n);
                flowLayoutPanel1.ScrollControlIntoView(n);
            }
            server.setGroupChatToEmpty(lbl_me.Text);
        }