Fix launcher not starting w/o internet, use bindings for moddropdown

pull/35/head
Miepee 4 years ago
parent 68fc1ad7b2
commit 00cd55b531

@ -791,12 +791,8 @@ public partial class MainForm : Form
profileButton.ToolTip = HelperMethods.GetText(Text.OpenProfileFolderToolTip, profileName);
saveButton.Enabled = true;
saveButton.ToolTip = HelperMethods.GetText(Text.OpenSaveFolderToolTip, profileName);
if (modSettingsProfileDropDown.SelectedIndex < 0 || modSettingsProfileDropDown.Items.Count == 0)
return;
profileNotesTextArea.TextColor = colorGreen;
profileNotesTextArea.Text = Text.ProfileNotes + "\n" + profileList[modSettingsProfileDropDown.SelectedIndex].ProfileNotes;
}
/// <summary>

@ -357,8 +357,6 @@ public partial class MainForm
}
// Update stored profiles in the Profile Settings tab
modSettingsProfileDropDown.Items.Clear();
modSettingsProfileDropDown.Items.AddRange(profileDropDown.Items);
modSettingsProfileDropDown.SelectedIndex = profileDropDown.Items.Count != 0 ? 0 : -1;
// Refresh the author and version label on the main tab

@ -654,7 +654,8 @@ public partial class MainForm : Form
if (OS.IsLinux)
modSettingsProfileDropDown = new DropDown();
modSettingsProfileDropDown.Items.AddRange(profileNames); // It's actually more comfortable if it's outside, because of GTK shenanigans
modSettingsProfileDropDown.DataStore = profileDropDown.DataStore; // It's actually more comfortable if it's outside, because of GTK shenanigans
modSettingsProfileDropDown.Bind(m => m.SelectedIndex, profileDropDown, p => p.SelectedIndex);
profileButton = new ColorButton
{

@ -147,15 +147,19 @@ public static class HelperMethods
public static bool IsConnectedToInternet()
{
log.Info("Checking internet connection...");
try
{
PingReply pingReply = new Ping().Send("github.com");
if (pingReply?.Status != IPStatus.Success)
if (pingReply?.Status == IPStatus.Success)
{
log.Info("Internet connection failed.");
return false;
}
log.Info("Internet connection established!");
return true;
}
}
catch { /* ignoring exceptions */ }
log.Info("Internet connection failed.");
return false;
}
/// <summary>
/// Gets <paramref name="languageText"/> and replaces "$NAME" with <paramref name="replacementText"/>.

Loading…
Cancel
Save