Beispiel #1
0
        //----------------------------------------------------------------

        private void btn_send_Click(object sender, EventArgs e)
        {
            Server.Service1 server = new Server.Service1();
            bool            ispassed, passed;

            server.SIsOfflineUser(lbl_connecteduser.Text, out passed, out ispassed);
            if (ispassed)
            {
                if (passed)
                {
                    MessageBox.Show("oops your friend has gone ! talk to u later :'D");
                    EnterUser.EnterUserForm.Show();
                    this.Hide();
                }
                else
                {
                    bool isHeConnected       = false;
                    bool isHeConnectedPassed = false;
                    server.isConnected(lbl_connecteduser.Text, ref isHeConnected, ref isHeConnectedPassed);
                    if (isHeConnected)
                    {
                        server.setChatToText(lbl_connecteduser.Text, txt_message.Text);
                        if (!(txt_message.Text == ""))
                        {
                            msg n = new msg(txt_message.Text, lbl_me.Text);
                            flowLayoutPanel1.Controls.Add(n);
                            flowLayoutPanel1.ScrollControlIntoView(n);
                        }
                    }
                    else
                    {
                        MessageBox.Show("User not connected");
                    }

                    /*msg n = new msg(txt_message.Text);
                     * flowLayoutPanel1.Controls.Add(n);*/
                    txt_message.Clear();
                }
            }
        }