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 ThreadTask()
 {
     while (true)
     {
         DroneConnection.receiveBatteryInfo();
         this.SetText(DroneConnection.battery);
     }
 }
Beispiel #3
0
 private void toDroneToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (prcs_handler.flag == false)
     {
         prcs_handler.start_prcs();
         prcs_handler.check();
         DroneConnection.createconnection();
     }
     else
     {
         MessageBox.Show("Already connected");
     }
 }
 public void RightButton_Click(object sender, EventArgs e)
 {
     DroneConnection.command = "Right";
     DroneConnection.sendcommand();
 }
 public void manualup()//Up
 {
     DroneConnection.command = "Up";
     DroneConnection.sendcommand();
 }
 public void manualright()
 {
     DroneConnection.command = "Right";
     DroneConnection.sendcommand();
 }
 public void manualLeft()
 {
     DroneConnection.command = "Left";
     DroneConnection.sendcommand();
 }
 public void manualontrol_takeoff()
 {
     DroneConnection.command = "Takeoff";
     DroneConnection.sendcommand();
 }
 public void manualontrol_land()
 {
     DroneConnection.command = "Land";
     DroneConnection.sendcommand();
 }
 public void manualHover()
 {
     DroneConnection.command = "Neutral";
     DroneConnection.sendcommand();
 }
 public void button7_Click(object sender, EventArgs e)//Up
 {
     DroneConnection.command = "Up";
     DroneConnection.sendcommand();
 }
 public void Landing_Click(object sender, EventArgs e)
 {
     DroneConnection.command = "Land";
     DroneConnection.sendcommand();
 }
 public void Backwards_Click(object sender, EventArgs e)
 {
     DroneConnection.command = "Backward";
     DroneConnection.sendcommand();
 }
 public void Takeoff_Click(object sender, EventArgs e)
 {
     DroneConnection.command = "Takeoff";
     DroneConnection.sendcommand();
 }
 public void ClockwiseLeft_Click(object sender, EventArgs e)
 {
     DroneConnection.command = "TurnLeft";
     DroneConnection.sendcommand();
 }
 public void Down_Click(object sender, EventArgs e)
 {
     DroneConnection.command = "Down";
     DroneConnection.sendcommand();
 }
 public void button10_Click(object sender, EventArgs e)// ClockwiseRight
 {
     DroneConnection.command = "TurnRight";
     DroneConnection.sendcommand();
 }
Beispiel #18
0
 private void button1_Click(object sender, EventArgs e)
 {
     DroneConnection.closeconnection();
 }
 /*The below code sends commands to the server program made in node js.*/
 public void button1_Click(object sender, EventArgs e)// Forward
 {
     DroneConnection.command = "Forward";
     DroneConnection.sendcommand();
 }