简体   繁体   English

Windows Phone 8.1在其他应用程序中打开链接

[英]Windows Phone 8.1 open link in other app

I have a program which can show some links (music/video/ etc....). 我有一个可以显示一些链接(音乐/视频/等...)的程序。 I want when Clicked on download button, my app send that link to UC Downloader for download. 我想要单击下载按钮时,我的应用程序将该链接发送到UC Downloader进行下载。 I can open link with Internet Explorer but I want open in UC Downloader. 我可以使用Internet Explorer打开链接,但我想在UC Downloader中打开。

You can launch an app from your code if you know. 如果您知道的话,可以从代码中启动应用程序。 From the msdn : msdn

By using the association launching API, your app can automatically launch another app by launching a custom URI. 通过使用关联启动API,您的应用可以通过启动自定义URI自动启动另一个应用。 To do this, use the Launcher.LaunchUriAsync(Uri) method from the Launcher object of the Windows.System namespace. 为此,请使用Windows.System命名空间的Launcher对象中的Launcher.LaunchUriAsync(Uri)方法。 For example, the following code launches a fictitious Contoso app to display new products. 例如,以下代码启动一个虚构的Contoso应用程序以显示新产品。

Example : 范例:

private async void LaunchContosoNewProductsButton_Click(object sender, RoutedEventArgs rea)
{
    // Launch URI.
    Windows.System.Launcher.LaunchUriAsync(new System.Uri("contoso:NewProducts"));
}

You can find a tutorial here . 您可以在此处找到教程

这是如何做。

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

In windows phone 8.1 在Windows Phone 8.1中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM