static bool IsNetworkAvailable (out NetworkReachabilityFlags flags)
{
if (defaultRouteReachability == null) {
var ipAddress = new IPAddress (0);
defaultRouteReachability = new NetworkReachability (ipAddress.MapToIPv6 ());
defaultRouteReachability.SetNotification (OnChange);
defaultRouteReachability.Schedule (CFRunLoop.Current, CFRunLoop.ModeDefault);
}
return defaultRouteReachability.TryGetFlags (out flags) && IsReachableWithoutRequiringConnection (flags);
}