Skip to content

Commit

Permalink
Fixed issue with QNH not refreshing properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
zizwiz committed May 16, 2024
1 parent af0f33d commit 207ca13
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 34 deletions.
26 changes: 13 additions & 13 deletions myFlightInfo/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions myFlightInfo/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private async void Form1_Load(object sender, EventArgs e)
cmbobx_airport_info.Visible = false;
cmbobx_gransden_lodge.Visible = false;
grpbx_altimeter.Visible = false;
btn_calculate_altimiter.Visible = false;
btn_navigation_calculations.Visible = false;

await webView_notams.EnsureCoreWebView2Async();
await webView_browser.EnsureCoreWebView2Async();
Expand Down Expand Up @@ -232,7 +232,7 @@ private void btn_reset_Click(object sender, EventArgs e)
}
}

private void btn_calculate_altimiter_Click(object sender, EventArgs e)
private void btn_navigation_calculations_Click(object sender, EventArgs e)
{
//Calculate settings for altitude at destination
/*
Expand Down Expand Up @@ -338,7 +338,7 @@ private void cmbobx_airport_info_SelectedIndexChanged(object sender, EventArgs e
if ((noInfoFlag) && (fromDataOK))
{
Navigate.SolarInfo(cmbobx_airport_info.Text, lstbx_navigation_to, year, month, day);
btn_calculate_altimiter.Visible = true; //Now show button to calculate
btn_navigation_calculations.Visible = true; //Now show button to calculate
}

}
Expand Down
4 changes: 2 additions & 2 deletions myFlightInfo/KeyDowns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == Keys.Enter) && ((tabcnt_toplevel.SelectedTab == tab_utils) && (tabcnt_utils.SelectedTab == tab_navigation)))
{
btn_calculate_altimiter.PerformClick();
btn_navigation_calculations.PerformClick();
}
else if ((e.KeyCode == Keys.Enter) && ((tabcnt_toplevel.SelectedTab == tab_utils) && (tabcnt_utils.SelectedTab == tab_crosswind)))
{
Expand All @@ -29,7 +29,7 @@ private void Navigation_Keydown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == Keys.Enter) && ((tabcnt_toplevel.SelectedTab == tab_utils) && (tabcnt_utils.SelectedTab == tab_navigation)))
{
btn_calculate_altimiter.PerformClick();
btn_navigation_calculations.PerformClick();
}
}

Expand Down
33 changes: 17 additions & 16 deletions myFlightInfo/Navigation/Altimeter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,23 @@ public static bool Calculate_altimeter(string present_pressure, string present_a
{
if (CheckDataCorrect(present_pressure, present_altitude, to_altitude))
{
//From Airfield
myListboxFrom.Items.Add("");
myListboxFrom.Items.Add("QNH = \t" + Math.Round(
(float.Parse(present_pressure) + ((float.Parse(present_altitude)) / 30)),
2).ToString() + " mb");
string QNH = "QNH = \t" + Math.Round(
(float.Parse(present_pressure) + (float.Parse(present_altitude) / 30)), 2).ToString() + " mb";

if (myListboxFrom.Items.Count >= 13)
{
//if it exists then remove it and then replace it with new value.
//From Airfield
myListboxFrom.Items.RemoveAt(13);
myListboxFrom.Items.Insert(13, QNH);
}
else
{
//It does not yet exist so write for first time
//From Airfield
myListboxFrom.Items.Add("");
myListboxFrom.Items.Add(QNH);
}

//To Airfield
lbl_to_pressure.Text = Math.Round(
Expand All @@ -41,17 +53,6 @@ public static bool Calculate_altimeter(string present_pressure, string present_a

return false;
}











}

/// <summary>
Expand Down

0 comments on commit 207ca13

Please sign in to comment.