Home >Backend Development >C#.Net Tutorial >Use a WPF program to launch a UWP program

Use a WPF program to launch a UWP program

零下一度
零下一度Original
2017-06-23 15:25:523743browse

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 PackageId is the package family name (PackageFamilyName)

3. Use Process.Start(new ProcessStartInfo("protocolname:"));

4. Use the command line

like:>start myapplication:protocol-parameter, refer to Accepting Parameters

The link also introduces another way: start activation (command line parameters are not supported), which will not be discussed here. Repeat.

After writing WPF for several months, I found that I had forgotten all the UWP stuff. Hey, such a weakling!

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn