gpt4 book ai didi

c# - LaunchUriAsync 未导航到正确的 uri

转载 作者:太空宇宙 更新时间:2023-11-03 16:20:49 25 4
gpt4 key购买 nike

我需要导航到我的 Metro 应用程序中的 Internet 页面。我的网址是(示例)“http://www.foo.com/#/foo”。问题是 LaunchUriAsync 将 url 剪切为“http://www.foo.com”。

try
{
Uri uri = new Uri(item.UriCode);
await Launcher.LaunchUriAsync(uri);
}
catch (Exception exception)
{
//TODO
}

我哪里错了?问候。

更新:

我确定 uri = http://www.foo.com/#/foo .所以问题来自 LaunchUriAsync 。

最佳答案

我尝试使用相同的代码对您提到的 uri 进行硬编码请检查以下代码:

    /// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
try
{
Uri uri = new Uri("http://www.foo.com/#/foo");
await Launcher.LaunchUriAsync(uri);
}
catch (Exception exception)
{
//TODO
}
}

输出如下图

Launcher Test with respective URL

我认为还有其他问题。可能与 item.UriCode 行有关,请检查。

关于c# - LaunchUriAsync 未导航到正确的 uri,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13967912/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com