mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Add connectivity check on startup
This commit is contained in:
parent
3a826519fe
commit
bfe32ab679
@ -147,6 +147,33 @@ namespace Bloxstrap
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsMenuLaunch)
|
||||
{
|
||||
Logger.WriteLine(LOG_IDENT, "Performing connectivity check");
|
||||
|
||||
try
|
||||
{
|
||||
HttpClient.GetAsync("https://detectportal.firefox.com").Wait();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(LOG_IDENT, "Connectivity check failed!");
|
||||
Logger.WriteException(LOG_IDENT, ex);
|
||||
|
||||
Controls.ShowMessageBox(
|
||||
"Bloxstrap is unable to connect to the internet. Please check your network configuration and try again.\n" +
|
||||
"\n" +
|
||||
"More information:\n" +
|
||||
ex.InnerException!.Message,
|
||||
MessageBoxImage.Error,
|
||||
MessageBoxButton.OK
|
||||
);
|
||||
|
||||
Terminate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// check if installed
|
||||
using (RegistryKey? registryKey = Registry.CurrentUser.OpenSubKey($@"Software\{ProjectName}"))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user