mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-28 07:39:49 +08:00
[Runner]Improve metered network detection (#24030)
This commit is contained in:
parent
8bcabe17e0
commit
4c3b470ec0
@ -88,7 +88,26 @@ bool IsMeteredConnection()
|
||||
{
|
||||
using namespace winrt::Windows::Networking::Connectivity;
|
||||
ConnectionProfile internetConnectionProfile = NetworkInformation::GetInternetConnectionProfile();
|
||||
return internetConnectionProfile && internetConnectionProfile.IsWwanConnectionProfile();
|
||||
if (!internetConnectionProfile)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (internetConnectionProfile.IsWwanConnectionProfile())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
ConnectionCost connectionCost = internetConnectionProfile.GetConnectionCost();
|
||||
if (connectionCost.Roaming()
|
||||
|| connectionCost.OverDataLimit()
|
||||
|| connectionCost.NetworkCostType() == NetworkCostType::Fixed
|
||||
|| connectionCost.NetworkCostType() == NetworkCostType::Variable)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ProcessNewVersionInfo(const github_version_info& version_info,
|
||||
|
Loading…
Reference in New Issue
Block a user