Skip to content

Commit 4b5b7ab

Browse files
Create unique route name by adding (1), (2) etc to the name. This is for adding or changing a route.
1 parent 0237cda commit 4b5b7ab

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

Source/Menu/ContentForm.Designer.cs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/Menu/ContentForm.cs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,6 +1406,18 @@ private void textBoxManualInstallRoute_TextChanged(object sender, EventArgs e)
14061406
{
14071407
// only update the grid when user is filling/changing the route in the textbox
14081408
dataGridViewManualInstall.CurrentRow.Cells[0].Value = textBoxManualInstallRoute.Text;
1409+
ManualInstallChangesMade = true;
1410+
buttonCancel.Enabled = true;
1411+
}
1412+
}
1413+
1414+
private void textBoxManualInstallRoute_Leave(object sender, EventArgs e)
1415+
{
1416+
string route = textBoxManualInstallRoute.Text;
1417+
textBoxManualInstallRoute.Text = determineUniqueRoute(route);
1418+
if (textBoxManualInstallRoute.Text != route)
1419+
{
1420+
dataGridViewManualInstall.CurrentRow.Cells[0].Value = textBoxManualInstallRoute.Text;
14091421
}
14101422
}
14111423

@@ -1524,17 +1536,18 @@ private void setTextBoxesManualInstall()
15241536
string determineUniqueRoute(string Route)
15251537
{
15261538
string route = Route;
1527-
1539+
long seqNr = 0;
15281540
bool found = false;
15291541

15301542
while (!found)
15311543
{
15321544
found = true;
15331545
for (int i = 0; i < dataGridViewManualInstall.Rows.Count - 1; i++)
15341546
{
1535-
if (dataGridViewManualInstall.Rows[i].Cells[0].Value.ToString() == route)
1547+
if ((dataGridViewManualInstall.Rows[i].Cells[0].Value.ToString() == route) && (!dataGridViewManualInstall.Rows[i].Selected))
15361548
{
1537-
route += " copy";
1549+
seqNr++;
1550+
route = Route + " (" + seqNr + ")";
15381551
found = false;
15391552
}
15401553
}

0 commit comments

Comments
 (0)