mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[PTRun][Program]Set logo on app package installation (#31495)
This commit is contained in:
committed by
GitHub
parent
1a20e351ae
commit
79de69547e
@@ -42,7 +42,7 @@ namespace Microsoft.Plugin.Program
|
||||
private static PluginInitContext _context;
|
||||
private readonly PluginJsonStorage<ProgramPluginSettings> _settingsStorage;
|
||||
private bool _disposed;
|
||||
private PackageRepository _packageRepository = new PackageRepository(new PackageCatalogWrapper());
|
||||
private PackageRepository _packageRepository;
|
||||
private static Win32ProgramFileSystemWatchers _win32ProgramRepositoryHelper;
|
||||
private static Win32ProgramRepository _win32ProgramRepository;
|
||||
|
||||
@@ -105,6 +105,7 @@ namespace Microsoft.Plugin.Program
|
||||
{
|
||||
_context = context ?? throw new ArgumentNullException(nameof(context));
|
||||
_context.API.ThemeChanged += OnThemeChanged;
|
||||
_packageRepository = new PackageRepository(new PackageCatalogWrapper(), _context);
|
||||
|
||||
var a = Task.Run(() =>
|
||||
{
|
||||
@@ -131,7 +132,7 @@ namespace Microsoft.Plugin.Program
|
||||
{
|
||||
foreach (UWPApplication app in _packageRepository)
|
||||
{
|
||||
app.UpdatePath(theme);
|
||||
app.UpdateLogoPath(theme);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -403,7 +403,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdatePath(Theme theme)
|
||||
public void UpdateLogoPath(Theme theme)
|
||||
{
|
||||
LogoPathFromUri(logoUri, theme);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ using Microsoft.Plugin.Program.Logger;
|
||||
using Microsoft.Plugin.Program.Programs;
|
||||
using Windows.ApplicationModel;
|
||||
using Wox.Infrastructure.Storage;
|
||||
using Wox.Plugin;
|
||||
using Wox.Plugin.Logger;
|
||||
|
||||
namespace Microsoft.Plugin.Program.Storage
|
||||
@@ -18,11 +19,14 @@ namespace Microsoft.Plugin.Program.Storage
|
||||
/// </summary>
|
||||
internal class PackageRepository : ListRepository<UWPApplication>, IProgramRepository
|
||||
{
|
||||
private IPackageCatalog _packageCatalog;
|
||||
private readonly IPackageCatalog _packageCatalog;
|
||||
private readonly PluginInitContext _context;
|
||||
|
||||
public PackageRepository(IPackageCatalog packageCatalog)
|
||||
public PackageRepository(IPackageCatalog packageCatalog, PluginInitContext context)
|
||||
{
|
||||
_packageCatalog = packageCatalog ?? throw new ArgumentNullException(nameof(packageCatalog), "PackageRepository expects an interface to be able to subscribe to package events");
|
||||
_context = context ?? throw new ArgumentNullException(nameof(context));
|
||||
|
||||
_packageCatalog.PackageInstalling += OnPackageInstalling;
|
||||
_packageCatalog.PackageUninstalling += OnPackageUninstalling;
|
||||
}
|
||||
@@ -40,6 +44,7 @@ namespace Microsoft.Plugin.Program.Storage
|
||||
uwp.InitializeAppInfo(packageWrapper.InstalledLocation);
|
||||
foreach (var app in uwp.Apps)
|
||||
{
|
||||
app.UpdateLogoPath(_context.API.GetCurrentTheme());
|
||||
Add(app);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user