how to get list of all installed apps and run them

2019-08-17 08:50发布

问题:

I'm actually creating an UWP 8.1 app for one of my client.And I've got some little issue with it.At some point of my app I've to get all the names of installed app in the device and view it as a list.When the user will click on any of them, I've to launch that certain app. I've already tried to add restricted capabilities in the app manifest but it shows a blue line when I add, Morever I can get access to the AppData/Packages by using folderpicker somehow but don't know what to do. The app is for WinRT surface 3 and it isn't going to store or anything it has only one user. So if anyone know any sort of solution please let me know.

回答1:

The PackageManager class has the methods to enumerate all installed apps.

However, in 8.1 the PackageManager can only be used in desktop apps (e.g. WPF, Winforms, Win32). It cannot be used from a Store app on that version of the operating system.

On Windows 10 you can use the class from both Store/UWP apps as well as classic desktop apps.