Hello.
Thank you to the ArduPilot community. I’m currently studying Mission Planner plugins.
The form is not properly closing. As shown in the video above, if I add Form.Close()
in the plugin’s Exit()
method, the Mission Planner console window does not close.
Am I causing any problems or conflicts?
I would appreciate an expert’s opinion.
Below is my code for Exit()
and Forms()
.
- Exit()
public override bool Exit()
{
myClient?.Close();
myStream?.Close();
if (formAISRawData != null)
{
formAISRawData.Close();
//formAISRawData.Dispose();
}
return true;
}
2.Form Code
public class FormAISRawData : Form
{
private Label lbl_RawData;
private Label lbl_ProcessedData;
private TextBox txb_RawData;
private TextBox txb_ProcessedData;
private Button button_StartStop;
public FormAISRawData()
{
lbl_RawData = new Label();
lbl_ProcessedData = new Label();
txb_RawData = new TextBox();
txb_ProcessedData = new TextBox();
button_StartStop = new Button();
Text = "FormAISRawData";
Size = new Size(500, 150);
FormBorderStyle = FormBorderStyle.FixedDialog;
StartPosition = FormStartPosition.CenterScreen;
lbl_RawData.Location = new Point(10, 20);
lbl_ProcessedData.Location = new Point(10, 50);
txb_RawData.Location = new Point(lbl_RawData.Right + 5, 20);
txb_ProcessedData.Location = new Point(lbl_RawData.Right + 5, 50);
button_StartStop.Location = new Point(lbl_ProcessedData.Left, 80);
button_StartStop.Text = "Start/Stop";
button_StartStop.ForeColor = Color.Gray;
button_StartStop.BackColor = Color.White;
button_StartStop.FlatAppearance.MouseOverBackColor = Color.LightBlue;
button_StartStop.FlatStyle = FlatStyle.Flat;
button_StartStop.UseVisualStyleBackColor = false;
button_StartStop.Click += button_StartStop_Click;
Controls.AddRange(new Control[] {lbl_RawData,lbl_ProcessedData,txb_RawData,txb_ProcessedData,button_StartStop});
}//end of FormAISRawData() Constructor
private void button_StartStop_Click(object sender, EventArgs e)
{
MessageBox.Show("Button is pressed");
}
}//end of FormAISRawData Class