Skip to content

Commit

Permalink
Small bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
daanbroekhuizen committed Feb 25, 2014
1 parent ccaf725 commit d78391b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1233,6 +1233,8 @@ private void runwayInfoButton_Click(object sender, EventArgs e)
//If runway info form doesn't exists OR isn't visible.
if (runwayInfo == null || !runwayInfo.Visible)
{
runwayInfo = new RunwayInfo(this, metarProcessor.metar);

//Initialize new RunwayInfo form.
runwayInfoButton.Text = "<";

Expand Down
31 changes: 25 additions & 6 deletions DutchVACCATISGenerator/DutchVACCATISGenerator/RunwayInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,12 @@ private Boolean nightTime()
DateTime nightStart = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 22, 00, 00);
DateTime nightEnd = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 6, 00, 00);

if (DateTime.UtcNow < nightStart && DateTime.UtcNow > nightEnd) return false;
//if (DateTime.UtcNow < nightStart && DateTime.UtcNow > nightEnd) return false;
//else return true;

DateTime dummy = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 3, 00, 00);

if (dummy < nightStart && dummy > nightEnd) return false;
else return true;
}

Expand Down Expand Up @@ -493,23 +498,37 @@ private void ICAOBestRunway(String icaoTab)
/// <returns>Best runway identifier</returns>
public String getBestRunway(DataGridView runwayInfoDataGridView, int prefColumn, int OKColumn)
{
//Best runway holder.
String runwayString = String.Empty;
//Highest preference.
int runwayPref = int.MaxValue;

//Iterate through each data row of the provided DataGridView.
foreach (DataGridViewRow row in runwayInfoDataGridView.Rows)
{
//If RWY is OK.
if (row.Cells[OKColumn].Value.Equals("OK"))
{
//Set runwayString for first iteration.
if (runwayString == String.Empty)
{
runwayString = row.Cells[0].Value.ToString();
runwayPref = Convert.ToInt32(row.Cells[prefColumn].Value);
//Check if pref column has valid value.
if (!row.Cells[prefColumn].Value.Equals("--"))
{
runwayString = row.Cells[0].Value.ToString();
runwayPref = Convert.ToInt32(row.Cells[prefColumn].Value);
}
}

if (Convert.ToInt32(row.Cells[prefColumn].Value) < runwayPref)
//Check if pref column has valid value.
if (!row.Cells[prefColumn].Value.Equals("--"))
{
runwayString = row.Cells[0].Value.ToString();
runwayPref = Convert.ToInt32(row.Cells[prefColumn].Value);
//If current iteration RWY pref is lower than highest recorded RWY pref.
if (Convert.ToInt32(row.Cells[prefColumn].Value) < runwayPref)
{
runwayString = row.Cells[0].Value.ToString();
runwayPref = Convert.ToInt32(row.Cells[prefColumn].Value);
}
}
}
}
Expand Down

0 comments on commit d78391b

Please sign in to comment.