コード例 #1
0
ファイル: createroom.cs プロジェクト: theaud/Chat_C-
        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
ファイル: client_login.cs プロジェクト: theaud/Chat_C-
 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
ファイル: client_login.cs プロジェクト: theaud/Chat_C-
 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();
     }
 }