[英]Windows Phone 8.1 open link in other app
我有一个可以显示一些链接(音乐/视频/等...)的程序。 我想要单击下载按钮时,我的应用程序将该链接发送到UC Downloader进行下载。 我可以使用Internet Explorer打开链接,但我想在UC Downloader中打开。
如果您知道的话,可以从代码中启动应用程序。 从msdn :
通过使用关联启动API,您的应用可以通过启动自定义URI自动启动另一个应用。 为此,请使用Windows.System命名空间的Launcher对象中的Launcher.LaunchUriAsync(Uri)方法。 例如,以下代码启动一个虚构的Contoso应用程序以显示新产品。
范例:
private async void LaunchContosoNewProductsButton_Click(object sender, RoutedEventArgs rea)
{
// Launch URI.
Windows.System.Launcher.LaunchUriAsync(new System.Uri("contoso:NewProducts"));
}
这是如何做。
Windows.System.Launcher.LaunchUriAsync(new Uri("uc-url:http://www.microsoft.com"));
private async void Button_Click(object sender, RoutedEventArgs e)
{
string uriToLaunch = @"http://www.bing.com";
var uri = new Uri(uriToLaunch);
var success = await Windows.System.Launcher.LaunchUriAsync(uri);
}
在Windows Phone 8.1中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.