有人能给我一个提示吗,如果C#启用/禁用了,如何在Windows 8.1.应用程序(而不是8.0!)上以编程方式检测?我不想改变这些设置,只是想知道.
该解决方案是Windows8.1通用应用程序,(Windows 8.1)项目仅引用Windows应用程序和Windows 8.1的.Net。按照建议添加C:\Program (x86)\Reference x86和查询IsWiFiEnabled属性不起作用-编译器错误:无法在mscorlib.dll中找到System.SystemException类型
谢谢你,马希尔
发布于 2014-11-05 11:24:16
如果您正在寻找非8.1 Silverlight解决方案:
您可以使用Windows.Networking.Connectivity命名空间来查询此名称空间。
MSDN NetworkInformation类
一个让你开始的例子
bool is_wifi_enabled = false;
Guid adapter_id = new Guid();
// get the list of connection profiles
// we need the adpater id for the wifi
foreach (var item in NetworkInformation.GetConnectionProfiles())
{
// check if wifi
if (item.IsWlanConnectionProfile)
{
// tag the adapter
adapter_id = item.NetworkAdapter.NetworkAdapterId;
}
}
// get all lan adapters (this most likely will be empty if wlan is disabled)
foreach (var item in NetworkInformation.GetLanIdentifiers())
{
if (item.NetworkAdapterId == adapter_id)
{
is_wifi_enabled = true;
}
}发布于 2014-11-05 10:46:52
使用IsWiFiEnabled属性DeviceNetworkInformation类
如果需要其他网络信息,可以参考如何到网络信息页面。
致以问候。
https://stackoverflow.com/questions/26754865
复制相似问题