File tree Expand file tree Collapse file tree
src/UniGetUI.Avalonia/Views/SoftwarePages Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using System . Diagnostics ;
22using System . Runtime . InteropServices ;
3- using Windows . Networking . Connectivity ;
43using Avalonia . Controls ;
54using UniGetUI . Avalonia . Infrastructure ;
65using UniGetUI . Avalonia . ViewModels . Pages ;
@@ -482,13 +481,15 @@ private static bool IsBatterySaverOn()
482481
483482 private static bool IsOnMeteredConnection ( )
484483 {
485- if ( ! OperatingSystem . IsWindows ( ) ) return false ;
486- #pragma warning disable CA1416
487- var costType = NetworkInformation
484+ #if WINDOWS
485+ var costType = Windows . Networking . Connectivity . NetworkInformation
488486 . GetInternetConnectionProfile ( )
489487 ? . GetConnectionCost ( )
490488 . NetworkCostType ;
491- return costType is NetworkCostType . Fixed or NetworkCostType . Variable ;
492- #pragma warning restore CA1416
489+ return costType is Windows . Networking . Connectivity . NetworkCostType . Fixed
490+ or Windows . Networking . Connectivity . NetworkCostType . Variable ;
491+ #else
492+ return false ;
493+ #endif
493494 }
494495}
You can’t perform that action at this time.
0 commit comments