@@ -18,7 +18,8 @@ private void btn_calc_speed_time_fuel_Click(object sender, EventArgs e)
18
18
try
19
19
{
20
20
if ( SpeedDataCheck ( txtbx_speed_wind_speed . Text , txtbx_speed_wind_direction . Text ,
21
- txtbx_speed_course . Text , txtbx_speed_true_airspeed . Text ) )
21
+ txtbx_speed_course . Text , txtbx_speed_true_airspeed . Text ,
22
+ txtbx_speed_wind_pre_flight_running . Text , txtbx_speed_wind_return_pre_flight_running . Text ) )
22
23
{
23
24
bool TimeFuelFlag = TimeFuelCheck ( txtbx_speed_distance . Text , txtbx_speed_fuel_consumption . Text ,
24
25
txtbx_min_landing_fuel . Text , txtbx_speed_fuel_specific_gravity . Text ) ;
@@ -178,7 +179,8 @@ private void btn_calc_speed_time_fuel_Click(object sender, EventArgs e)
178
179
}
179
180
180
181
181
- private bool SpeedDataCheck ( string myWindStrength , string myDirection , string myCourse , string myAirspeed )
182
+ private bool SpeedDataCheck ( string myWindStrength , string myDirection , string myCourse , string myAirspeed ,
183
+ string mySpeed_wind_pre_flight_running , string mySpeed_wind_return_pre_flight_running )
182
184
{
183
185
//catch for incomplete data
184
186
if ( myCourse == "" )
@@ -270,6 +272,25 @@ private bool SpeedDataCheck(string myWindStrength, string myDirection, string my
270
272
MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
271
273
return false ;
272
274
}
275
+ else if ( ( double . Parse ( mySpeed_wind_pre_flight_running ) < 0 ) || ( double . Parse ( mySpeed_wind_pre_flight_running ) > 999 ) )
276
+ {
277
+ MsgBox . Show ( "Check Pre-flight running Data is a valid number >0 and <999)" , "Data out of scope" ,
278
+ MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
279
+ return false ;
280
+ }
281
+ else if ( ( double . Parse ( mySpeed_wind_return_pre_flight_running ) < 0 ) || ( double . Parse ( mySpeed_wind_return_pre_flight_running ) > 999 ) )
282
+ {
283
+ MsgBox . Show ( "Check Return Pre-flight running Data is a valid number >0 and <999)" , "Data out of scope" ,
284
+ MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
285
+ return false ;
286
+ }
287
+
288
+ if ( double . Parse ( myAirspeed ) < double . Parse ( myWindStrength ) )
289
+ {
290
+ MsgBox . Show ( "Flying into a wind that is faster than your airspeed means you fly backwards, not advisable, best stay at home." , "Stay at Home" ,
291
+ MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
292
+ return false ;
293
+ }
273
294
274
295
return true ;
275
296
}
0 commit comments