private void frmMain_FormClosing(object sender, FormClosingEventArgs e) { if (cockpit != null) { cockpit.Close(); } }
public void DisplayCockpitInstance() { frm = new frmCockpit(); frm.LoadLayout("Cessna 152 ASOBO"); frm.Show(); Thread.Sleep(1000); var result = GetRequest("INDCATED AIRSPEED", "knots"); frm.ResultUpdate(result); Thread.Sleep(3000); result.Result = 100; frm.ResultUpdate(result); Thread.Sleep(3000); result.Result = 200; Thread.Sleep(3000); frm.Close(); frm.Dispose(); }
private void pbShowCockpit_Click(object sender, EventArgs e) { var cmdButton = (Button)sender; if (cockpit == null) { cmdButton.Text = "Hide Cockpit"; ReloadCockpit(cmbCockpitLayout.Text); this.Focus(); } else { cmdButton.Text = "Show Cockpit"; if (cockpit.Visible) { cockpit.Visible = false; cockpit?.Close(); } cockpit?.Dispose(); cockpit = null; } }