如何使用XAML在默认浏览器中打开URL(windows-8应用程序)

时间:2013-06-12 01:30:55

标签: c# .net url windows-8

如何使用XAML(Windows-8应用程序)在默认浏览器中打开URL

使用时:

Process.Start("http://www.google.com/"); 

错误名称空间'System.Diagnostics'中不存在类型或命名空间名称'Process'(您是否缺少程序集引用?)

1 个答案:

答案 0 :(得分:5)

您可以使用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
    }
}
相关问题