我想从Windows Phone 8.1环境中的其他应用启动我的应用。我按照MSDN中的说明进行操作,但我无法弄清楚如何从第二个应用程序调用第一个应用程序。这是我在第一个应用程序的清单文件中添加的协议:
<Extensions>
<Extension Category="windows.protocol">
<Protocol Name="myapp">
<Logo>Assets\SmallLogo.scale-240.png</Logo>
<DisplayName>my App 1</DisplayName>
</Protocol>
</Extension>
</Extensions>
这是我从第二个应用程序调用的,它绝对没有任何内容:
private async void btn_Click(object sender, RoutedEventArgs e)
{
await Windows.System.Launcher.LaunchUriAsync(new System.Uri("myapp:"));
}
答案 0 :(得分:0)
按照Auto-launching apps using file and URI associations for Windows Phone 8
中的步骤操作您使用了一个派生自UriMapperBase
的类来处理导航,并且必须在App.xaml.cs中将其设置为RootFrame.UriMapper
private void InitializePhoneApplication()
{
if (phoneApplicationInitialized)
return;
// Create the frame but don't set it as RootVisual yet; this allows the splash
// screen to remain active until the application is ready to render.
RootFrame = new PhoneApplicationFrame();
RootFrame.Navigated += CompleteInitializePhoneApplication;
// Assign the URI-mapper class to the application frame.
RootFrame.UriMapper = new AssociationUriMapper();
******
}