예제 #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);
            }
        }
예제 #2
0
        private void opendirectory_FileOk(object sender, CancelEventArgs e)
        {
            Image img = Image.FromStream(opendirectory.OpenFile());

            byte[] myarray = imageToByteArray(img);
            int    i       = myarray.Length;

            Server.Service1 server = new Server.Service1();
            try
            {
                server.setChatToImage(lbl_connecteduser.Text, myarray, i, true);
                imagemsg n = new imagemsg(lbl_me.Text, img);
                flowLayoutPanel1.Controls.Add(n);
                flowLayoutPanel1.ScrollControlIntoView(n);
            }
            catch (Exception)
            {
                MessageBox.Show("too big file !");
                this.Show();
            }
        }