【发布时间】:2013-06-12 01:30:55
【问题描述】:
如何在默认浏览器中使用 XAML(windows-8 应用程序)打开 URL
使用时:
Process.Start("http://www.google.com/");
错误命名空间“System.Diagnostics”中不存在类型或命名空间名称“Process”(您是否缺少程序集引用?)
【问题讨论】:
如何在默认浏览器中使用 XAML(windows-8 应用程序)打开 URL
使用时:
Process.Start("http://www.google.com/");
错误命名空间“System.Diagnostics”中不存在类型或命名空间名称“Process”(您是否缺少程序集引用?)
【问题讨论】:
您可以使用Launcher.LaunchUriAsync 方法。
private async void LaunchSite(string siteAddress)
{
try
{
Uri uri = new Uri(siteAddress);
var launched = await Windows.System.Launcher.LaunchUriAsync(uri);
}
catch (Exception ex)
{
//handle the exception
}
}
【讨论】:
using Windows.System; 或输入命名空间。
Windows.System.Launcher.LaunchUriAsync(uri);)