Netify
V1.1.1

當網絡連接更改時,立即通知。
您可以使用.NET CLI將NETIFY添加到您的項目中:
dotnet add package Netify
或Nuget軟件包管理器控制台:
Install-Package Netify
using Netify ;
using static System . Console ;
var networkStatusNotifier = new NetworkStatusNotifier ( ) ;
var sampleApp = new SampleApp ( networkStatusNotifier ) ;
networkStatusNotifier . Start ( ) ;
sampleApp . DoSomething ( ) ;
networkStatusNotifier . Stop ( ) ;
internal class SampleApp : INetworkObserver
{
public SampleApp ( INetworkStatusNotifier networkStatusNotifier )
{
networkStatusNotifier . AddObserver ( this ) ;
}
public void ConnectivityChanged ( ConnectivityStatus status )
{
WriteLine ( $ "Connectivity status changed: { status } " ) ;
}
public void DoSomething ( )
{
WriteLine ( "Change your connection status to see app reaction." ) ;
ReadKey ( ) ;
}
} 
