mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Check if the connection is metered and, if so, ask the user if they want to proceed
This commit is contained in:
parent
5d1aa50753
commit
1c02c8c1b3
@ -18,6 +18,7 @@ using System.Windows.Forms;
|
||||
using System.Windows.Shell;
|
||||
|
||||
using Microsoft.Win32;
|
||||
using Windows.Networking.Connectivity;
|
||||
|
||||
using Bloxstrap.AppData;
|
||||
using Bloxstrap.RobloxInterfaces;
|
||||
@ -578,6 +579,24 @@ namespace Bloxstrap
|
||||
string version = App.Version;
|
||||
#endif
|
||||
|
||||
// check if we are on a metered connection, as updating Bloxstrap might incur additional costs
|
||||
var profile = NetworkInformation.GetInternetConnectionProfile();
|
||||
bool meteredConnection = (profile != null) && (profile.GetConnectionCost().NetworkCostType != NetworkCostType.Unrestricted);
|
||||
|
||||
if (meteredConnection)
|
||||
{
|
||||
App.Logger.WriteLine(LOG_IDENT, "Metered connection detected");
|
||||
|
||||
var result = Frontend.ShowMessageBox(
|
||||
Strings.Bootstrapper_AutoUpdateMetered,
|
||||
MessageBoxImage.Exclamation,
|
||||
MessageBoxButton.YesNo
|
||||
);
|
||||
|
||||
if (result != MessageBoxResult.Yes)
|
||||
return false;
|
||||
}
|
||||
|
||||
SetStatus(Strings.Bootstrapper_Status_UpgradingBloxstrap);
|
||||
|
||||
try
|
||||
|
9
Bloxstrap/Resources/Strings.Designer.cs
generated
9
Bloxstrap/Resources/Strings.Designer.cs
generated
@ -160,6 +160,15 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to An update for Bloxstrap is available, but it has been detected you are currently using a metered connection. Would you like to update now?.
|
||||
/// </summary>
|
||||
public static string Bootstrapper_AutoUpdateMetered {
|
||||
get {
|
||||
return ResourceManager.GetString("Bootstrapper.AutoUpdateMetered", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Roblox is currently running, and launching another instance will close it. Are you sure you want to continue launching?.
|
||||
/// </summary>
|
||||
|
@ -1267,4 +1267,7 @@ Please close any applications that may be using Roblox's files, and relaunch.</v
|
||||
<value>All Bloxstrap logs</value>
|
||||
<comment>Label that appears next to a checkbox</comment>
|
||||
</data>
|
||||
<data name="Bootstrapper.AutoUpdateMetered" xml:space="preserve">
|
||||
<value>An update for Bloxstrap is available, but it has been detected you are currently using a metered connection. Would you like to update now?</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user