System.Diagnostics.Process 在 Windows 10 中不起作用 [英] System.Diagnostics.Process not working in Windows 10

查看:39
本文介绍了System.Diagnostics.Process 在 Windows 10 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 UWP 应用,当用户单击按钮时,我需要在其中启动 Microsoft Edge 或 Internet Explorer.

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.

我发现这样做的方法是调用 System.Diagnostics.Process.Start() 但我得到:

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

命名空间System.Diagnostics"中不存在类型或命名空间名称Process"

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

我尝试用 NuGet 安装它,但我也遇到了几个异常...

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

我也尝试过使用 Launcher,但它没有做任何事情:

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!

推荐答案

您可以使用 LaunchUriAsync要求 Windows 启动与协议(例如:http://)关联的应用程序并将 Uri 传递给它.

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"));

在这种情况下,您的默认浏览器将打开 http://danvy.tv .

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

这篇关于System.Diagnostics.Process 在 Windows 10 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆