简体   繁体   English

System.Diagnostics.Process在Windows 10中不起作用

[英]System.Diagnostics.Process not working in Windows 10

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. 我正在使用UWP应用程序,当用户单击按钮时,我需要在其中启动Microsoft Edge或Internet Explorer。

I've found that the way to do it is calling the System.Diagnostics.Process.Start() but I get: 我发现执行此操作的方法是调用System.Diagnostics.Process.Start()但得到:

The type or namespace name 'Process' does not exist in the namespace 'System.Diagnostics' 类型或名称空间名称“ Process”在名称空间“ System.Diagnostics”中不存在

I've tried to install it with NuGet but I've gotten several Exceptions also... 我试图用NuGet安装它,但是我也遇到了几个例外。

I've also tried using Launcher, but it hasn't done anything: 我也尝试过使用Launcher,但没有做任何事情:

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

Does anyone know how to implement what I need? 有人知道如何实现我的需求吗? Thank you! 谢谢!

you can use LaunchUriAsync To ask Windows to launch the app associated with a protocol (ex: http://) and pass the Uri to it. 您可以使用LaunchUriAsync要求Windows启动与协议关联的应用程序(例如:http://)并将Uri传递给它。

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

In this case, your default browser will open http://danvy.tv . 在这种情况下,您的默认浏览器将打开http://danvy.tv

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM