启动 Windows 10 商店应用程序

启动 Windows 10 商店应用程序

问题描述:

我正在寻找一种在 Windows 10/8.1 上从 C# 启动/运行 Windows 商店应用程序的方法.

I am looking for a way to launch/run windows store apps on windows 10/8.1 from C#.

我尝试运行的应用程序示例是

Examples of the apps I am trying to run are

  1. 计算器
  2. 照片
  3. 设置

注意:在 Windows 10 中,这些不再是可以通过双击或调用 Process.Start() 执行的标准 .exe 文件,因为它们现在是 Windows 商店应用程序.

Note: in Windows 10 these are no longer standard .exe files that can be executed by double clicking or calling Process.Start() as they are now windows store apps.

我曾尝试使用 IApplicationActivationManager,但找不到像样的文档以及如何使用它的示例.

I have tried to use IApplicationActivationManager but I cannot find decent documentation with examples of how to use it.

有几种方法可以做到.最简单的方法是使用 Process.Start 和 URL 或文件处理程序.

There are several ways to do it. The easiest way is to use Process.Start and the URL or file handlers.

例如,这将打开视频应用:

For example this will open the Video app:

Process.Start("microsoftvideo://");

或更新页面上的商店:

Process.Start("ms-windows-store:updates");

或照片应用:

Process.Start("ms-photos://");

还有几个句柄,其中一些你可以找到 此处.您可以在打开注册表项 HKEY_CLASSES_ROOT\Extensions\ContractId\Windows.Protocol\PackageId 时找到这些名称.查找 CustomProperties 键.它有一个属性Name.这就是要使用的.

There are several more handles, some of them can you find here. You can find the names when you open the registry key HKEY_CLASSES_ROOT\Extensions\ContractId\Windows.Protocol\PackageId. Look for the CustomProperties key. It has an attribute Name. That is the one to use.

在 SU 上可以找到其他一些有用的指针:如何在 Windows 8 中从命令行运行 Metro 应用程序?.

Some other useful pointer can be found on SU: How do I run a Metro-Application from the command-line in Windows 8?.