Beispiel #1
0
        private void timer_Tick(object sender, EventArgs e)
        {
            string message = "";

            Server.Service1 server = new Server.Service1();
            server.setConnected(lbl_me.Text, true, true);
            server.getChatText(lbl_me.Text, ref message);
            if (!(message == ""))
            {
                msg n = new msg(message, lbl_connecteduser.Text);
                flowLayoutPanel1.Controls.Add(n);
                flowLayoutPanel1.ScrollControlIntoView(n);
                server.setChatToEmpty(lbl_me.Text);
            }
            bool ispassed;
            bool passed;

            server.checkimage(lbl_me.Text, out passed, out ispassed);
            if (passed)
            {
                int length;
                server.getimagelength(lbl_me.Text, out length, out ispassed);
                byte[] array = new byte[length];
                server.getChatImage(lbl_me.Text, ref array);
                Image    img = byteArrayToImage(array);
                imagemsg p   = new imagemsg(lbl_connecteduser.Text, img);
                flowLayoutPanel1.Controls.Add(p);
                flowLayoutPanel1.ScrollControlIntoView(p);
                server.setImageToEmpty(lbl_me.Text);
            }
        }
Beispiel #2
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);
        }