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; } } } }
查看全文
相关阅读:
【WF2017】Mission Improbable
【Codeforces 837D】Round Subset
【Codeforces 788C】The Great Mixing
【JSOI2008】最大数
2.1图像的数字化
MATLAB生成随机数
四六级准考证号忘记了如何快速查询四六级成绩?
加密与水印结合
如何在 PyPI安装python的软件包?
matlab中如何定义函数
原文地址:https://www.cnblogs.com/javawebsoa/p/2458110.html
最新文章
快速幂||取余运算 (分治算法)
NOIP2016提高组初赛(2)四、读程序写结果3、求最长回文子序列
NOIP2016提高组初赛(2)四、阅读程序写结果2、
NOIP2016提高组初赛(1)
给dalao们递dalao们的博客
USACO1.1 Broken Necklace
treap
11.12今天的我不懂写什么标题
递归线段树模板
高精度/低精度
热门文章
拓扑排序
回文相关
huangwenlong and hanqihong开光的dijkstra
线段树速撸
高精速撸project A*B
博客迁移了
NOIP
【POJ2823】Sliding Window
【POJ3254】Corn Fields
自己写的各种模板
Copyright © 2011-2022 走看看