private void Off_Click(object sender, EventArgs e)//Connect/Disconnect button { if (prcs_handler.flag == false) { prcs_handler.start_prcs(); prcs_handler.check(); DroneConnection.createconnection(); Thread.Sleep(6000); pictureBox1.Load(@"http://localhost:8080/"); timer1.Start(); this.trd = new Thread(new ThreadStart(this.ThreadTask)); trd.IsBackground = true; trd.Start(); Off.Text = "Connected"; } else { DroneConnection.closeconnection(); prcs_handler.stop_prcs(); trd.Abort(); timer1.Stop(); Off.Text = "Disconnected"; } }
private void button1_Click(object sender, EventArgs e) { DroneConnection.closeconnection(); }