예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string username = c2.username;
            string password = c2.password;

            if (textBox2.Text == null || textBox2.Text == String.Empty)
            {
                MessageBox.Show("Room name can't be empty!");
            }
            else
            {
                c2.ClientSocket.Send(Encoding.Unicode.GetBytes("CREATE_ROOM" + "µ" + username + "µ" + password + "µ" + textBox2.Text + "µ" + "\r\n"));
                System.Threading.Thread.SpinWait(10000);
                do
                {
                } while (validateRoom == "null");
                if (validateRoom == "success")
                {
                    validateRoom = "null";
                    choose_room c3 = new choose_room(c2);
                    c3.username = c2.username;
                    this.Hide();
                    c3.ShowDialog();
                }
            }
        }
예제 #2
0
 private void button2_Click(object sender, EventArgs e)//log in part
 {
     c5.username  = username.Text.ToString();
     c5.password  = password.Text.ToString();
     c5.room_name = "empty";
     c5.ClientSocket.Send(Encoding.Unicode.GetBytes("CONNECTION" + "µ" + username.Text.ToString() + "µ" + password.Text.ToString()
                                                    + "µ" + "\r\n"));
     do
     {
     } while (checkConnection == "null");
     if (checkConnection == "success")
     {
         checkConnection = "null";
         choose_room c4 = new choose_room(c5);
         c4.username = username.Text.ToString();
         this.Hide();
         c4.ShowDialog();
     }
 }
예제 #3
0
파일: client.cs 프로젝트: theaud/Chat_C-
        private void button2_Click(object sender, EventArgs e) //change the room
        {
            MsgSend = Encoding.Unicode.GetBytes("CHANGE_ROOM" + "µ" + username + "µ" + "\n\r");

            ClientSocket.Send(MsgSend);
            MessageBox.Show("room menu");
            do
            {
            } while (check_roomchange != "checked");

            check_roomchange   = "wrong";
            room_name          = "empty";
            this.textBox1.Text = "";
            this.listBox1.Items.Clear();
            choose_room c4 = new choose_room(this);

            c4.username = username;
            this.Hide();
            c4.ShowDialog();
        }
예제 #4
0
 private void button1_Click(object sender, EventArgs e)//register
 {
     c5.ClientSocket.Send(Encoding.Unicode.GetBytes("REGISTER" + "µ" + username.Text.ToString() + "µ" + password.Text.ToString() + "µ" + "\r\n"));
     c5.username  = username.Text.ToString();
     c5.password  = password.Text.ToString();
     c5.room_name = "empty";
     //we wait until the login and the password are checked by the server.
     do
     {
     } while (checkConnection == "null");
     //the login and password are good
     if (checkConnection == "success")
     {
         checkConnection = "null";
         choose_room c4 = new choose_room(c5);
         c4.username = username.Text.ToString();
         this.Hide();
         c4.ShowDialog();
     }
 }