System.Diagnostics.Process not working in Windows 10

a 夏天 提交于 2019-12-23 02:03:44

问题


I'm working in a UWP app in which I need to launch Microsoft Edge or Internet Explorer when the users clicks on a button.

I've found that the way to do it is calling the System.Diagnostics.Process.Start() but I get:

The type or namespace name 'Process' does not exist in the namespace 'System.Diagnostics'

I've tried to install it with NuGet but I've gotten several Exceptions also...

I've also tried using Launcher, but it hasn't done anything:

await Launcher.LaunchUriAsync(new Uri("LINK"));

Does anyone know how to implement what I need? Thank you!


回答1:


you can use LaunchUriAsync To ask Windows to launch the app associated with a protocol (ex: http://) and pass the Uri to it.

await Windows.System.Launcher.LaunchUriAsync(new Uri("http://danvy.tv"));

In this case, your default browser will open http://danvy.tv .



来源:https://stackoverflow.com/questions/34268249/system-diagnostics-process-not-working-in-windows-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!