Skip to content

Commit 1987ba1

Browse files
committed
Fix build on non-windows
1 parent 49716c9 commit 1987ba1

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

src/UniGetUI.Avalonia/Views/SoftwarePages/SoftwareUpdatesPage.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Diagnostics;
22
using System.Runtime.InteropServices;
3-
using Windows.Networking.Connectivity;
43
using Avalonia.Controls;
54
using UniGetUI.Avalonia.Infrastructure;
65
using 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
}

0 commit comments

Comments
 (0)