有没有办法在C#中以编程方式关闭WiFi

时间:2021-03-03 08:19:45

But in such a way that there is absolutely NO TRANSMISSION out of it? No searching for hotspots nor any keepalives or any other transmission?

但是这样的方式绝对没有传输吗?没有搜索热点,也没有任何Keepalive或任何其他传输?

Thank you very much, Yaron.

非常感谢,Yaron。

3 个解决方案

#1


0  

You can check the How to use the connection settings task for Windows Phone 8. You can use the

您可以查看Windows Phone 8的“如何使用连接设置”任务。您可以使用

var navigate = Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-location:"));

which will navigate you to the settings page where you can turn off and on the wifi settings.

这将导航到您可以关闭和设置的设置页面。

#2


0  

You can't change them programmatically, but you can ask a user to change them and redirect a user to the Settings page (for this purpose use ConnectionSettingsTask http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394011(v=vs.105).aspx).

您不能以编程方式更改它们,但您可以要求用户更改它们并将用户重定向到“设置”页面(为此目的使用ConnectionSettingsTask http://msdn.microsoft.com/en-us/library/windowsphone/develop /hh394011(v=vs.105).aspx)。

This is because the platform leaves these kinds of settings in the user's control at all times.

这是因为平台始终在用户的控件中保留这些类型的设置。

ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask();
connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi;
connectionSettingsTask.Show();

The closest you can get is to programmatically launch the WiFi settings page where the user can modify the setting:

您可以获得的最接近的是以编程方式启动WiFi设置页面,用户可以在其中修改设置:

await Launcher.LaunchUriAsync(new Uri("ms-settings-wifi:"));

#3


0  

In Windows 10 you can use this API

在Windows 10中,您可以使用此API

There is a sample of its usage published by Microsoft here

这里有一个由Microsoft发布的使用示例

#1


0  

You can check the How to use the connection settings task for Windows Phone 8. You can use the

您可以查看Windows Phone 8的“如何使用连接设置”任务。您可以使用

var navigate = Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-location:"));

which will navigate you to the settings page where you can turn off and on the wifi settings.

这将导航到您可以关闭和设置的设置页面。

#2


0  

You can't change them programmatically, but you can ask a user to change them and redirect a user to the Settings page (for this purpose use ConnectionSettingsTask http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394011(v=vs.105).aspx).

您不能以编程方式更改它们,但您可以要求用户更改它们并将用户重定向到“设置”页面(为此目的使用ConnectionSettingsTask http://msdn.microsoft.com/en-us/library/windowsphone/develop /hh394011(v=vs.105).aspx)。

This is because the platform leaves these kinds of settings in the user's control at all times.

这是因为平台始终在用户的控件中保留这些类型的设置。

ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask();
connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi;
connectionSettingsTask.Show();

The closest you can get is to programmatically launch the WiFi settings page where the user can modify the setting:

您可以获得的最接近的是以编程方式启动WiFi设置页面,用户可以在其中修改设置:

await Launcher.LaunchUriAsync(new Uri("ms-settings-wifi:"));

#3


0  

In Windows 10 you can use this API

在Windows 10中,您可以使用此API

There is a sample of its usage published by Microsoft here

这里有一个由Microsoft发布的使用示例