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; } } } }
查看全文
相关阅读:
二叉树的遍历
十进制与m进制的相互转化
【素数】Prime Distance
【数论】Sumdiv(整数的唯一分解定理+约束和公式+递归求等比)
【错位+组合】排列计数
【扩展欧几里得】青蛙的约会
【归并排序+逆序数】poj-2299 Ultra-QuickSort
【模拟】Sandglass
【位运算】高效解决n皇后问题
Popular Cows
原文地址:https://www.cnblogs.com/javawebsoa/p/2458110.html
最新文章
Equal Cut
食物链I
F: 取数游戏III (思维+简单dp)
java BigInteger BigDicimal例题
【KMP】Radio Transmission
【KMP】剪花布条
KMP的理解与模板
2018年第四阶段组队训练赛第十一场
2018年第四阶段组队训练赛第十场
[单调栈]Max answer
热门文章
[贪心]T-net
[bfs]调酒壶里的酸奶
[dp]Find Symmetries
[矩阵快速幂]Gdut Count
[dfs剪枝]球队“食物链”
[思维]Tree Burning
[位运算]签到题
[思维]Colorful Hats
[思维]Ants on a Circle
【欧拉函数筛】Visible Lattice Points
Copyright © 2011-2022 走看看