Nick
Nick

Reputation: 10499

How to set a static IP in a UWP?

I need to set a static IP address of a device with Windows 10 mobile. I am developing an Universal Windows App (UWP).

How can I do?

I tried following this article: https://blogs.msdn.microsoft.com/softwaresimian/2014/09/10/setting-an-ip-to-address-to-be-static-and-then-dynamic-in-c/

But some of the classes are missing (like ManagementClass).

Upvotes: 1

Views: 767

Answers (2)

Joel
Joel

Reputation: 2361

UWP applications are made to run in a sandbox. You won't have access to any APIs that change system settings or anything that could potentially change the behaviour of another application. At most you could have the application open the connection settings UI but it would be up to the user to perform actual changes.

The code that you reference should run in a WPF application or a console application. If you want to launch the Wi-Fi settings dialog you can use the following.

bool result = await Launcher.LaunchUriAsync(new Uri("ms-settings:network-wifi"));

Upvotes: 1

Igor Kulman
Igor Kulman

Reputation: 16361

Not possible to affect system level settings from an app.

Upvotes: 2

Related Questions