void ConnectClick(object sender, System.EventArgs e) { //Step 1: Ket noi toi server int flag; tcp = new TCPModel(textBox1.Text, int.Parse(textBox2.Text)); flag = tcp.ConnectToServer(); if (flag == -1) { MessageBox.Show("Server chưa mở hoặc bị lỗi"); return; } btconnect.Enabled = false; btbatdau.Enabled = true; label7.Visible = false; progressBar1.Value = 0; Thread t = new Thread(nhandulieu); //t.Priority = ThreadPriority.AboveNormal; t.Start(); Thread t1 = new Thread(drawstraight); // t1.Priority = ThreadPriority.Normal; t1.Start(); flagRuncancau = false; Thread t2 = new Thread(Run); //t2.Priority = ThreadPriority.Lowest; t2.Start(); }
void Button1Click(object sender, System.EventArgs e) { //Step 1: Ket noi toi server tcp = new TCPModel(textBox1.Text, int.Parse(textBox2.Text)); int flag = tcp.ConnectToServer(); button1.Enabled = false; Thread t = new Thread(ReceiveData); t.Start(); }