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); profileButton.ToolTip = HelperMethods.GetText(Text.OpenProfileFolderToolTip, profileName);
saveButton.Enabled = true; saveButton.Enabled = true;
saveButton.ToolTip = HelperMethods.GetText(Text.OpenSaveFolderToolTip, profileName); saveButton.ToolTip = HelperMethods.GetText(Text.OpenSaveFolderToolTip, profileName);
if (modSettingsProfileDropDown.SelectedIndex < 0 || modSettingsProfileDropDown.Items.Count == 0)
return;
profileNotesTextArea.TextColor = colorGreen; profileNotesTextArea.TextColor = colorGreen;
profileNotesTextArea.Text = Text.ProfileNotes + "\n" + profileList[modSettingsProfileDropDown.SelectedIndex].ProfileNotes; profileNotesTextArea.Text = Text.ProfileNotes + "\n" + profileList[modSettingsProfileDropDown.SelectedIndex].ProfileNotes;
} }
/// <summary> /// <summary>

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

@ -654,7 +654,8 @@ public partial class MainForm : Form
if (OS.IsLinux) if (OS.IsLinux)
modSettingsProfileDropDown = new DropDown(); 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 profileButton = new ColorButton
{ {

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

Loading…
Cancel
Save