Skip to content

Commit 70536a8

Browse files
committed
Automatic merge of T1.5.1-1284-gca636331f4 and 13 pull requests
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #891 at 9a1d6b2: Auto save - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #952 at 8347095: Investigation - Pulsing graphics - Pull request #953 at a519452: Fix Lights Crash on Corrupt Shapes - Pull request #954 at 62061b8: Multiple Track Profiles & Superelevation Improvements - Pull request #972 at e90a2aa: On Map window color changed switch or signal is not changed - Pull request #980 at 555619e: Downloading route content (Github, zip) second part - Pull request #981 at 10d297f: Multiple type trainset lightglows - Pull request #982 at efcf19c: WEB based Switch Panel enhancement: Alerter - Pull request #984 at 0f8122e: Player train switching for timetable mode - Pull request #900 at c27f32d: DMI updates - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder
15 parents cac388a + ca63633 + d00beb9 + 9a1d6b2 + 1f5ba4c + 8347095 + a519452 + 62061b8 + e90a2aa + 555619e + 10d297f + efcf19c + 0f8122e + c27f32d + f92de76 commit 70536a8

File tree

1 file changed

+35
-25
lines changed

1 file changed

+35
-25
lines changed

Source/Menu/ContentForm.cs

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,11 @@ private void buttonManualInstallAdd_Click(object sender, EventArgs e)
13801380
{
13811381
In_buttonManualInstallAdd_Click = true;
13821382

1383-
int currentIndex = dataGridViewManualInstall.CurrentCell.RowIndex;
1383+
int currentIndex = -1;
1384+
if (dataGridViewManualInstall.CurrentCell != null)
1385+
{
1386+
currentIndex = dataGridViewManualInstall.CurrentCell.RowIndex;
1387+
}
13841388
int addedIndex = dataGridViewManualInstall.Rows.Add();
13851389
dataGridViewManualInstall.Rows[addedIndex].Selected = true;
13861390
dataGridViewManualInstall.FirstDisplayedScrollingRowIndex = addedIndex;
@@ -1400,10 +1404,13 @@ private void buttonManualInstallAdd_Click(object sender, EventArgs e)
14001404
}
14011405
else
14021406
{
1403-
// Cancel, set focus back to where is was and remove the empty row
1404-
dataGridViewManualInstall.CurrentCell = dataGridViewManualInstall.Rows[currentIndex].Cells[0];
1405-
dataGridViewManualInstall.Rows[currentIndex].Selected = true;
1406-
dataGridViewManualInstall.FirstDisplayedScrollingRowIndex = currentIndex;
1407+
if (currentIndex > -1)
1408+
{
1409+
// Cancel, set focus back to where is was and remove the empty row
1410+
dataGridViewManualInstall.CurrentCell = dataGridViewManualInstall.Rows[currentIndex].Cells[0];
1411+
dataGridViewManualInstall.Rows[currentIndex].Selected = true;
1412+
dataGridViewManualInstall.FirstDisplayedScrollingRowIndex = currentIndex;
1413+
}
14071414

14081415
dataGridViewManualInstall.Rows.Remove(dataGridViewManualInstall.Rows[addedIndex]);
14091416
}
@@ -1424,27 +1431,30 @@ private void buttonManualInstallDelete_Click(object sender, EventArgs e)
14241431

14251432
private void setTextBoxesManualInstall()
14261433
{
1427-
string route = dataGridViewManualInstall.CurrentRow.Cells[0].Value.ToString();
1428-
string path = dataGridViewManualInstall.CurrentRow.Cells[1].Value.ToString();
1429-
1430-
if (!AutoInstallRoutes.ContainsKey(route))
1431-
{
1432-
// route not automatically installed
1433-
textBoxManualInstallRoute.Text = route;
1434-
textBoxManualInstallPath.Text = path;
1435-
textBoxManualInstallRoute.Enabled = true;
1436-
textBoxManualInstallPath.Enabled = true;
1437-
buttonManualInstallBrowse.Enabled = true;
1438-
buttonManualInstallDelete.Enabled = true;
1439-
}
1440-
else
1434+
if (dataGridViewManualInstall.CurrentRow != null)
14411435
{
1442-
textBoxManualInstallRoute.Text = "";
1443-
textBoxManualInstallPath.Text = "";
1444-
textBoxManualInstallRoute.Enabled = false;
1445-
textBoxManualInstallPath.Enabled = false;
1446-
buttonManualInstallBrowse.Enabled = false;
1447-
buttonManualInstallDelete.Enabled = false;
1436+
string route = dataGridViewManualInstall.CurrentRow.Cells[0].Value.ToString();
1437+
string path = dataGridViewManualInstall.CurrentRow.Cells[1].Value.ToString();
1438+
1439+
if (!AutoInstallRoutes.ContainsKey(route))
1440+
{
1441+
// route not automatically installed
1442+
textBoxManualInstallRoute.Text = route;
1443+
textBoxManualInstallPath.Text = path;
1444+
textBoxManualInstallRoute.Enabled = true;
1445+
textBoxManualInstallPath.Enabled = true;
1446+
buttonManualInstallBrowse.Enabled = true;
1447+
buttonManualInstallDelete.Enabled = true;
1448+
}
1449+
else
1450+
{
1451+
textBoxManualInstallRoute.Text = "";
1452+
textBoxManualInstallPath.Text = "";
1453+
textBoxManualInstallRoute.Enabled = false;
1454+
textBoxManualInstallPath.Enabled = false;
1455+
buttonManualInstallBrowse.Enabled = false;
1456+
buttonManualInstallDelete.Enabled = false;
1457+
}
14481458
}
14491459
}
14501460

0 commit comments

Comments
 (0)