在Windows 8中获取已安装的Windows应用商店应用的本地化名称

Elm*_*lmo 14 .net c# vb.net windows-8

我想ListBox在Windows 8桌面应用程序中使用所有已安装的Windows应用商店应用的本地化显示名称填充a .我试过这个:

string Apps = Interaction.Environ("ProgramFiles") + "\\WindowsApps";
foreach ( App in IO.Directory.GetDirectories(Apps)) {
            XmlDocument xml = new XmlDocument();
            xml.LoadXml(My.Computer.FileSystem.ReadAllText(App + "\\AppxManifest.xml"));
            lbApps.Items.Add(xml.GetElementsByTagName("DisplayName")(0).InnerText);
 }
Run Code Online (Sandbox Code Playgroud)

但它会添加ms-resource已卸载的字符串和默认应用程序.

编辑:我发现所有已安装的应用程序都有自己的快捷方式,%LocalAppData%\Microsoft\Windows\Application Shortcuts但这些快捷方式没有本地化名称,打开时无效.

Nat*_*hta 1

不要直接解析 AppxManifest 文件,而是使用该类PackageManager

在 MSDN 上,有相当多的示例演示如何收集有关已安装应用程序包的各种内容,包括按用户 SID 枚举应用程序包示例