// Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Generic; using System.Security.Principal; using Windows.Management.Deployment; using Package = Windows.ApplicationModel.Package; namespace Microsoft.Plugin.Program.Programs { public class PackageManagerWrapper : IPackageManager { readonly PackageManager packageManager; public PackageManagerWrapper() { packageManager = new PackageManager(); } public IEnumerable FindPackagesForCurrentUser() { List packages = new List(); var user = WindowsIdentity.GetCurrent().User; if (user != null) { var id = user.Value; var m = this.packageManager.FindPackagesForUser(id); foreach (Package p in m) { packages.Add(PackageWrapper.GetWrapperFromPackage(p)); } } return packages; } } }