Skip to content

Commit 3e390b8

Browse files
Removed the "Start" button in the "Content " window
1 parent c296b32 commit 3e390b8

File tree

3 files changed

+208
-211
lines changed

3 files changed

+208
-211
lines changed

Source/Menu/DownloadContentForm.Designer.cs

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

Source/Menu/DownloadContentForm.cs

Lines changed: 27 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -303,24 +303,14 @@ private async void DownloadContentButton_Click(object sender, EventArgs e)
303303
Settings.Folders.Save();
304304
Settings.Content.Save();
305305

306-
if (!string.IsNullOrWhiteSpace(route.Start.Route))
307-
{
308-
// start information available
309-
MessageBox.Show(Catalog.GetString("Route installed, press 'Start' button to start Open Rails for this route."),
310-
Catalog.GetString("Done"), MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
311-
}
312-
else
313-
{
314-
// no start information available
315-
MainForm mainForm = ((MainForm)Owner);
316-
mainForm.DoWithTask = false;
317-
mainForm.LoadFolderList();
318-
mainForm.comboBoxFolder.SelectedIndex = determineSelectedIndex(mainForm.comboBoxFolder, RouteName);
319-
mainForm.DoWithTask = true;
306+
MainForm mainForm = ((MainForm)Owner);
307+
mainForm.LoadFolderListWhithoutTask();
308+
mainForm.comboBoxFolder.SelectedIndex = determineSelectedIndex(mainForm.comboBoxFolder, RouteName);
320309

321-
MessageBox.Show(Catalog.GetString("Route installed."),
322-
Catalog.GetString("Done"), MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
323-
}
310+
MessageBox.Show(Catalog.GetString("Route installed."),
311+
Catalog.GetString("Done"), MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
312+
313+
Refresh();
324314

325315
EnableButtons();
326316
}
@@ -479,7 +469,6 @@ private bool sumMB(string path)
479469
}
480470
catch (Exception)
481471
{
482-
// catch all errors during the delete
483472
return false;
484473
}
485474

@@ -758,73 +747,6 @@ private bool infoChangedAndAddedFileForGitHubDownloadType(ContentRouteSettings.R
758747
}
759748
#endregion
760749

761-
#region StartButton
762-
void StartButton_Click(object sender, EventArgs e)
763-
{
764-
DisableButtons();
765-
766-
ContentRouteSettings.Route route = Routes[RouteName];
767-
string contentName = route.ContentName;
768-
MainForm mainForm = ((MainForm)Owner);
769-
770-
mainForm.DoWithTask = false;
771-
772-
try
773-
{
774-
mainForm.LoadFolderList();
775-
mainForm.comboBoxFolder.SelectedIndex = determineSelectedIndex(mainForm.comboBoxFolder, contentName);
776-
777-
mainForm.LoadRouteList();
778-
mainForm.comboBoxRoute.SelectedIndex = determineSelectedIndex(mainForm.comboBoxRoute, route.Start.Route);
779-
780-
mainForm.radioButtonModeActivity.Checked = true;
781-
782-
mainForm.LoadActivityList();
783-
mainForm.comboBoxActivity.SelectedIndex = determineSelectedIndex(mainForm.comboBoxActivity, route.Start.Activity);
784-
785-
if ((route.Start.Activity == "- Explore Route -") || (route.Start.Activity == "+ Explore in Activity Mode +"))
786-
{
787-
mainForm.LoadLocomotiveList();
788-
mainForm.comboBoxLocomotive.SelectedIndex = determineSelectedIndex(mainForm.comboBoxLocomotive, route.Start.Locomotive);
789-
mainForm.comboBoxConsist.SelectedIndex = determineSelectedIndex(mainForm.comboBoxConsist, route.Start.Consist);
790-
791-
mainForm.LoadStartAtList();
792-
mainForm.comboBoxStartAt.SelectedIndex = determineSelectedIndex(mainForm.comboBoxStartAt, route.Start.StartingAt);
793-
mainForm.comboBoxHeadTo.SelectedIndex = determineSelectedIndex(mainForm.comboBoxHeadTo, route.Start.HeadingTo);
794-
795-
mainForm.comboBoxStartTime.Text = route.Start.Time;
796-
mainForm.comboBoxStartSeason.SelectedIndex = determineSelectedIndex(mainForm.comboBoxStartSeason, route.Start.Season);
797-
mainForm.comboBoxStartWeather.SelectedIndex = determineSelectedIndex(mainForm.comboBoxStartWeather, route.Start.Weather);
798-
}
799-
}
800-
catch (StartNotFound error)
801-
{
802-
803-
string message = Catalog.GetStringFmt("Starting not possible, start from main form instead. Searching for '{0}'.", error.Message);
804-
MessageBox.Show(message, Catalog.GetString("Attention"), MessageBoxButtons.OK, MessageBoxIcon.Error);
805-
806-
mainForm.DoWithTask = true;
807-
808-
// close this dialog
809-
DialogResult = DialogResult.OK;
810-
811-
setCursorToDefaultCursor();
812-
ClosingBlocked = false;
813-
814-
return;
815-
}
816-
817-
mainForm.DoWithTask = true;
818-
819-
// close this dialog
820-
DialogResult = DialogResult.OK;
821-
822-
// close the MainForm dialog, starts OR
823-
Owner.DialogResult = DialogResult.OK;
824-
825-
ClosingBlocked = false;
826-
}
827-
828750
private int determineSelectedIndex(ComboBox comboBox, string compareWith)
829751
{
830752
bool found = false;
@@ -928,7 +850,6 @@ public StartNotFound(string message)
928850
: base(message)
929851
{ }
930852
}
931-
#endregion
932853

933854
#region DeleteButton
934855
private async void DeleteButton_Click(object sender, EventArgs e)
@@ -982,6 +903,9 @@ private async void DeleteButton_Click(object sender, EventArgs e)
982903

983904
dataGridViewDownloadContent.CurrentRow.Cells[1].Value = "";
984905

906+
MainForm mainForm = ((MainForm)Owner);
907+
mainForm.LoadFolderListWhithoutTask();
908+
985909
Refresh();
986910

987911
EnableButtons();
@@ -993,7 +917,7 @@ private void deleteRoute(string directoryInstalledIn)
993917
{
994918
ContentRouteSettings.directoryDelete(directoryInstalledIn);
995919
});
996-
// start download in thread to be able to show the progress in the main thread
920+
// start delete in thread to be able to show the progress in the main thread
997921
deleteThread.Start();
998922

999923
while (deleteThread.IsAlive)
@@ -1055,6 +979,11 @@ private void updateButton_Click(object sender, EventArgs e)
1055979
MessageBox.Show(message, Catalog.GetString("Attention"), MessageBoxButtons.OK, MessageBoxIcon.Information);
1056980
}
1057981

982+
MainForm mainForm = ((MainForm)Owner);
983+
mainForm.comboBoxFolder.SelectedIndex = determineSelectedIndex(mainForm.comboBoxFolder, RouteName);
984+
985+
Refresh();
986+
1058987
EnableButtons();
1059988
}
1060989

@@ -1089,6 +1018,13 @@ private bool doThePull(ContentRouteSettings.Route route) {
10891018
}
10901019
#endregion
10911020

1021+
#region okButton
1022+
void okButton_Click(object sender, EventArgs e)
1023+
{
1024+
DialogResult = DialogResult.OK;
1025+
}
1026+
#endregion
1027+
10921028
private void DisableButtons()
10931029
{
10941030
setCursorToWaitCursor();
@@ -1097,11 +1033,10 @@ private void DisableButtons()
10971033
InstallPathTextBox.Enabled = false;
10981034
InstallPathBrowseButton.Enabled = false;
10991035
infoButton.Enabled = false;
1100-
11011036
downloadContentButton.Enabled = false;
1102-
startButton.Enabled = false;
1103-
deleteButton.Enabled = false;
11041037
updateButton.Enabled = false;
1038+
deleteButton.Enabled = false;
1039+
okButton.Enabled = false;
11051040
}
11061041

11071042
private void setCursorToWaitCursor()
@@ -1121,9 +1056,9 @@ private void EnableButtons()
11211056
InstallPathBrowseButton.Enabled = true;
11221057
infoButton.Enabled = true;
11231058
downloadContentButton.Enabled = !route.Installed;
1124-
startButton.Enabled = route.Installed && !string.IsNullOrWhiteSpace(route.Start.Route);
1125-
deleteButton.Enabled = route.Installed;
11261059
updateButton.Enabled = route.Installed && (route.getDownloadType() == ContentRouteSettings.DownloadType.github);
1060+
deleteButton.Enabled = route.Installed;
1061+
okButton.Enabled = true;
11271062

11281063
setCursorToDefaultCursor();
11291064
}

0 commit comments

Comments
 (0)