当前位置: 首页>>代码示例>>C#>>正文


C# NetworkReachability.SetCallback方法代码示例

本文整理汇总了C#中NetworkReachability.SetCallback方法的典型用法代码示例。如果您正苦于以下问题:C# NetworkReachability.SetCallback方法的具体用法?C# NetworkReachability.SetCallback怎么用?C# NetworkReachability.SetCallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NetworkReachability的用法示例。


在下文中一共展示了NetworkReachability.SetCallback方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsNetworkAvaialable

		static bool IsNetworkAvaialable (out NetworkReachabilityFlags flags)
		{
			if (defaultRouteReachability == null){
				defaultRouteReachability = new NetworkReachability (new IPAddress (0));
				defaultRouteReachability.SetCallback (OnChange);
				defaultRouteReachability.Schedule (CFRunLoop.Current, CFRunLoop.ModeDefault);
			}
			if (defaultRouteReachability.TryGetFlags (out flags))
			    return false;
			return IsReachableWithoutRequiringConnection (flags);
		}	
开发者ID:oduma,项目名称:Sciendo.Fitas.Droid,代码行数:11,代码来源:Reachability.cs

示例2: IsAdHocWiFiNetworkAvailable

		public static bool IsAdHocWiFiNetworkAvailable (out NetworkReachabilityFlags flags)
		{
			if (adHocWiFiNetworkReachability == null){
				adHocWiFiNetworkReachability = new NetworkReachability (new IPAddress (new byte [] {169,254,0,0}));
				adHocWiFiNetworkReachability.SetCallback (OnChange);
				adHocWiFiNetworkReachability.Schedule (CFRunLoop.Current, CFRunLoop.ModeDefault);
			}
	
			if (!adHocWiFiNetworkReachability.TryGetFlags (out flags))
				return false;
	
			return IsReachableWithoutRequiringConnection (flags);
		}
开发者ID:oduma,项目名称:Sciendo.Fitas.Droid,代码行数:13,代码来源:Reachability.cs

示例3: FinishedLaunching

    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    {
        imageCarrier = UIImage.FromFile ("WWAN5.png");
        imageWiFi = UIImage.FromFile ("Airport.png");
        imageStop = UIImage.FromFile ("stop-32.png");

        nr = new NetworkReachability ("www.apple.com");
        nr.SetCallback (ReachabilityChanged);
        nr.Schedule (CFRunLoop.Current, CFRunLoop.ModeDefault);

        AddTable ();
        //UpdateStatus ();
        //UpdateCarrierWarning ();

        window.MakeKeyAndVisible ();

        return true;
    }
开发者ID:CVertex,项目名称:monotouch-samples,代码行数:18,代码来源:main.cs

示例4: RemoteHostStatus

        public static NetworkStatus RemoteHostStatus(string HostName)
        {
            NetworkReachabilityFlags flags;
            bool reachable;

            if (remoteHostReachability == null) {
                remoteHostReachability = new NetworkReachability (HostName);

                // Need to probe before we queue, or we wont get any meaningful values
                // this only happens when you create NetworkReachability from a hostname
                reachable = remoteHostReachability.TryGetFlags (out flags);

                remoteHostReachability.SetCallback (OnChange);
                remoteHostReachability.Schedule (CFRunLoop.Current, CFRunLoop.ModeDefault);
            } else
                reachable = remoteHostReachability.TryGetFlags (out flags);

            if (!reachable)
                return NetworkStatus.NotReachable;

            if (!IsReachableWithoutRequiringConnection (flags))
                return NetworkStatus.NotReachable;

            if ((flags & NetworkReachabilityFlags.IsWWAN) != 0)
                return NetworkStatus.ReachableViaCarrierDataNetwork;

            return NetworkStatus.ReachableViaWiFiNetwork;
        }
开发者ID:valryon,项目名称:super-koikoukesse,代码行数:28,代码来源:NetworkAvailability.cs

示例5: RemoteHostStatus

    public static NetworkStatus RemoteHostStatus()
    {
        NetworkReachabilityFlags flags;
        bool reachable;

        if (remoteHostReachability == null)
        {
            remoteHostReachability = new NetworkReachability (HostName);

            reachable = remoteHostReachability.TryGetFlags (out flags);

            remoteHostReachability.SetCallback (OnChange);
            remoteHostReachability.Schedule (CFRunLoop.Current, CFRunLoop.ModeDefault);
        }
        else
            reachable = remoteHostReachability.TryGetFlags (out flags);

        if (!reachable)
            return NetworkStatus.NotReachable;

        if (!IsReachableWithoutRequiringConnection (flags))
            return NetworkStatus.NotReachable;

        if ((flags & NetworkReachabilityFlags.IsWWAN) != 0)
            return NetworkStatus.ReachableViaCarrierDataNetwork;

        return NetworkStatus.ReachableViaWiFiNetwork;
    }
开发者ID:pmourfield,项目名称:AtlCodeCamp,代码行数:28,代码来源:Reachability.cs

示例6: Reachability

 /// <summary>
 /// Initializes a new instance of the <see cref="Reachability.Reachability"/> class.
 /// </summary>
 /// <param name='reachability'>
 /// NetworkReachability instance to use
 /// </param>
 /// <param name='hasWWAN'>
 /// Platform has a WWAN interface
 /// </param>
 protected Reachability(NetworkReachability reachability, bool hasWWAN)
 {
     NetworkReachability = reachability;
     HasWWAN = hasWWAN;
     AllowWWAN = true;
     NetworkReachability.SetCallback(OnReachabilityNotification);
     NetworkReachability.Schedule(CFRunLoop.Current, CFRunLoop.ModeDefault);
 }
开发者ID:danclarke,项目名称:Reachability,代码行数:17,代码来源:Reachability.cs


注:本文中的NetworkReachability.SetCallback方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。