MissionPlanner.temp.but_armandtakeoff_Click C# (CSharp) Method

but_armandtakeoff_Click() private method

private but_armandtakeoff_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private void but_armandtakeoff_Click(object sender, EventArgs e)
        {
            try
            {

                MainV2.comPort.setMode("Stabilize");

                if (MainV2.comPort.doARM(true))
                {
                    MainV2.comPort.setMode("GUIDED");

                    Thread.Sleep(300);

                    MainV2.comPort.doCommand(MAVLink.MAV_CMD.TAKEOFF, 0, 0, 0, 0, 0, 0, 10);
                }
            }
            catch (Exception ex)
            {
                CustomMessageBox.Show(ex.ToString());
            }
        }