Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
private static bool ShouldLoadHiResolutionPicture()
{
var connectionCost = NetworkInformation.GetInternetConnectionProfile()?.GetConnectionCost();
if (connectionCost == null)
{
return false;
}
switch (connectionCost.NetworkCostType)
{
case NetworkCostType.Unrestricted:
return true;
case NetworkCostType.Fixed:
case NetworkCostType.Variable:
return !connectionCost.ApproachingDataLimit && !connectionCost.OverDataLimit && !connectionCost.Roaming;
default:
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment