zoukankan
html css js c++ java
Windows Phone 7 开发之检查手机网络
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using Microsoft.Phone.Controls; using System.Net.NetworkInformation; using Microsoft.Phone.Net.NetworkInformation; namespace checknet { public partial class MainPage : PhoneApplicationPage { private bool networkIsAvailable; private NetworkInterfaceType _currentNetworkType; //网络连接的类型 public MainPage() { InitializeComponent(); } private void button1_Click(object sender, RoutedEventArgs e) { networkIsAvailable = Microsoft.Phone.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();//当前网络是否可用 _currentNetworkType = Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType;//获取当前网络的类型 if (networkIsAvailable) { Message.Text = "联网状态"; Message.Background = new SolidColorBrush(Colors.Green); } else { Message.Text = "断网状态"; Message.Background = new SolidColorBrush(Colors.Red); } switch (_currentNetworkType) { case NetworkInterfaceType.MobileBroadbandCdma: netname.Text = "Cdma网络"; break; case NetworkInterfaceType.MobileBroadbandGsm: netname.Text = "Csm网络"; break; case NetworkInterfaceType.Wireless80211: netname.Text = "Wireless网络"; break; case NetworkInterfaceType.Ethernet: netname.Text = "Ethernet网络"; break; case NetworkInterfaceType.None: netname.Text = "网络不可用"; break; default: netname.Text = "其他的网络"; break; } } } }
查看全文
相关阅读:
[zt]在XML序列化时去除默认命名空间xmlns:xsd和xmlns:xsi
线程间操作无效: 从不是创建控件“...”的线程访问它。
Unity IoC + WCF + wsHTTPBinding + Certificate Authorization
[转]PowerDesigner使用教程 —— 概念数据模型
C# Post数据和接收简单示例【摘】
163相册验证码图片的识别手记之一 去除干扰
实现WCF和Unity 的集成
Html.ActionLink 几种重载方式说明及例子
如何从程序员到项目经理【转帖51cto】
OSG闪存
原文地址:https://www.cnblogs.com/javawebsoa/p/2458110.html
最新文章
PPT快捷键大全
设计模式之适配器模式
[转载]jQuery操作Table学习总结
在C#中ParameterizedThreadStart和ThreadStart区别
用于验证码图片识别的类(C#源码)
asp.net mvc filter
通过隐藏option实现select的联动效果
ASP.NET MVC:Expression Trees 作为参数简化查询
ASP.NET MVC案例教程(基于ASP.NET MVC beta)——第六篇:拦截器
C# WebBrowser 设置代理完全解决方案
热门文章
关于C#中timer类
JMail 参考接收发送邮件解决方案
WebRequest之Post写法
适配器模式(Adapter)和外观模式(Facade)
客户端动态调用WCF服务中的方法
动态生成 WCF Client Proxy 代码 —— My Svcutil
多种替身邮方法总结!
sql like in 语句获取以逗号分割的字段内的数据
Html.DropDownList()的用法 ( Asp.Net MVC)
(zz)jQuery 对checkbox的操作
Copyright © 2011-2022 走看看