mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
Packaged apps test (#4921)
* Added wrapper for PackageManager and Package class * Added tests for package in development and framework mode * Renamed UWP test file * Improved readability of UWP tests
This commit is contained in:
committed by
GitHub
parent
ec803d63c8
commit
653ae777d5
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Packaging;
|
||||
using System.Security.Principal;
|
||||
using Windows.Management.Deployment;
|
||||
using Windows.ApplicationModel;
|
||||
using Package = Windows.ApplicationModel.Package;
|
||||
|
||||
namespace Microsoft.Plugin.Program.Programs
|
||||
{
|
||||
public class PackageManagerWrapper : IPackageManager
|
||||
{
|
||||
readonly PackageManager packageManager;
|
||||
|
||||
public PackageManagerWrapper()
|
||||
{
|
||||
packageManager = new PackageManager();
|
||||
}
|
||||
|
||||
public IEnumerable<IPackage> FindPackagesForCurrentUser()
|
||||
{
|
||||
List<PackageWrapper> packages = new List<PackageWrapper>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user