Due to various reasons, I need to use a WPF program to launch a UWP program. Let’s summarize it below and give myself a backup.
The key to starting a UWP program is protocol startup
Add a protocol to our UWP application, like this:
Then use the protocol There are several ways to launch the UWP:
1. Use UWP's Launcher API
// Create the URI to launch from a string.
var uri = new Uri("protocolname :");
// Launch the URI.
bool success = await Windows.System.Launcher.LaunchUriAsync(uri);
This involves a question: How to do it in WPF Using UWP's API, you can refer to the link:
2. Use PackageManager, which is also UWP's API
// var Manager = New PackageManager ();
// var P = Manager. FindPackagesForUser("", PackageId);
//var ls = await p.ToList()[0].GetAppListEntriesAsync();
//foreach (var item in ls)
//{
.
The above is the detailed content of Use a WPF program to launch a UWP program. For more information, please follow other related articles on the PHP Chinese website!