Skip to content

Commit 207ca13

Browse files
committed
Fixed issue with QNH not refreshing properly.
1 parent af0f33d commit 207ca13

File tree

4 files changed

+35
-34
lines changed

4 files changed

+35
-34
lines changed

myFlightInfo/Form1.Designer.cs

+13-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

myFlightInfo/Form1.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ private async void Form1_Load(object sender, EventArgs e)
9797
cmbobx_airport_info.Visible = false;
9898
cmbobx_gransden_lodge.Visible = false;
9999
grpbx_altimeter.Visible = false;
100-
btn_calculate_altimiter.Visible = false;
100+
btn_navigation_calculations.Visible = false;
101101

102102
await webView_notams.EnsureCoreWebView2Async();
103103
await webView_browser.EnsureCoreWebView2Async();
@@ -232,7 +232,7 @@ private void btn_reset_Click(object sender, EventArgs e)
232232
}
233233
}
234234

235-
private void btn_calculate_altimiter_Click(object sender, EventArgs e)
235+
private void btn_navigation_calculations_Click(object sender, EventArgs e)
236236
{
237237
//Calculate settings for altitude at destination
238238
/*
@@ -338,7 +338,7 @@ private void cmbobx_airport_info_SelectedIndexChanged(object sender, EventArgs e
338338
if ((noInfoFlag) && (fromDataOK))
339339
{
340340
Navigate.SolarInfo(cmbobx_airport_info.Text, lstbx_navigation_to, year, month, day);
341-
btn_calculate_altimiter.Visible = true; //Now show button to calculate
341+
btn_navigation_calculations.Visible = true; //Now show button to calculate
342342
}
343343

344344
}

myFlightInfo/KeyDowns.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ private void Form1_KeyDown(object sender, KeyEventArgs e)
99
{
1010
if ((e.KeyCode == Keys.Enter) && ((tabcnt_toplevel.SelectedTab == tab_utils) && (tabcnt_utils.SelectedTab == tab_navigation)))
1111
{
12-
btn_calculate_altimiter.PerformClick();
12+
btn_navigation_calculations.PerformClick();
1313
}
1414
else if ((e.KeyCode == Keys.Enter) && ((tabcnt_toplevel.SelectedTab == tab_utils) && (tabcnt_utils.SelectedTab == tab_crosswind)))
1515
{
@@ -29,7 +29,7 @@ private void Navigation_Keydown(object sender, KeyEventArgs e)
2929
{
3030
if ((e.KeyCode == Keys.Enter) && ((tabcnt_toplevel.SelectedTab == tab_utils) && (tabcnt_utils.SelectedTab == tab_navigation)))
3131
{
32-
btn_calculate_altimiter.PerformClick();
32+
btn_navigation_calculations.PerformClick();
3333
}
3434
}
3535

myFlightInfo/Navigation/Altimeter.cs

+17-16
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,23 @@ public static bool Calculate_altimeter(string present_pressure, string present_a
1818
{
1919
if (CheckDataCorrect(present_pressure, present_altitude, to_altitude))
2020
{
21-
//From Airfield
22-
myListboxFrom.Items.Add("");
23-
myListboxFrom.Items.Add("QNH = \t" + Math.Round(
24-
(float.Parse(present_pressure) + ((float.Parse(present_altitude)) / 30)),
25-
2).ToString() + " mb");
21+
string QNH = "QNH = \t" + Math.Round(
22+
(float.Parse(present_pressure) + (float.Parse(present_altitude) / 30)), 2).ToString() + " mb";
23+
24+
if (myListboxFrom.Items.Count >= 13)
25+
{
26+
//if it exists then remove it and then replace it with new value.
27+
//From Airfield
28+
myListboxFrom.Items.RemoveAt(13);
29+
myListboxFrom.Items.Insert(13, QNH);
30+
}
31+
else
32+
{
33+
//It does not yet exist so write for first time
34+
//From Airfield
35+
myListboxFrom.Items.Add("");
36+
myListboxFrom.Items.Add(QNH);
37+
}
2638

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

4254
return false;
4355
}
44-
45-
46-
47-
48-
49-
50-
51-
52-
53-
54-
5556
}
5657

5758
/// <summary>

0 commit comments

Comments
 (0)