mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 11:16:51 +02:00
Standardizing built-in extension icon handling (#40606)
Just standardizing built-in extensions to use a `internal sealed class Icons` for all their non-dynamic icons. Looks like a LOT of changes, but it's icons all the way down.
This commit is contained in:
@@ -24,14 +24,6 @@ public partial class InstallPackageCommand : InvokableCommand
|
||||
|
||||
public PackageInstallCommandState InstallCommandState { get; private set; }
|
||||
|
||||
public static IconInfo CompletedIcon { get; } = new("\uE930"); // Completed
|
||||
|
||||
public static IconInfo UpdateIcon { get; } = new("\uE74A"); // Up
|
||||
|
||||
public static IconInfo DownloadIcon { get; } = new("\uE896"); // Download
|
||||
|
||||
public static IconInfo DeleteIcon { get; } = new("\uE74D"); // Delete
|
||||
|
||||
public event EventHandler<InstallPackageCommand>? InstallStateChanged;
|
||||
|
||||
private static readonly CompositeFormat UninstallingPackage = System.Text.CompositeFormat.Parse(Properties.Resources.winget_uninstalling_package);
|
||||
@@ -69,9 +61,9 @@ public partial class InstallPackageCommand : InvokableCommand
|
||||
{
|
||||
Icon = InstallCommandState switch
|
||||
{
|
||||
PackageInstallCommandState.Install => DownloadIcon,
|
||||
PackageInstallCommandState.Update => UpdateIcon,
|
||||
PackageInstallCommandState.Uninstall => CompletedIcon,
|
||||
PackageInstallCommandState.Install => Icons.DownloadIcon,
|
||||
PackageInstallCommandState.Update => Icons.UpdateIcon,
|
||||
PackageInstallCommandState.Uninstall => Icons.CompletedIcon,
|
||||
_ => throw new NotImplementedException(),
|
||||
};
|
||||
Name = InstallCommandState switch
|
||||
|
||||
@@ -190,7 +190,7 @@ public partial class InstallPackageListItem : ListItem
|
||||
CommandContextItem uninstallContextItem = new(installCommand)
|
||||
{
|
||||
IsCritical = true,
|
||||
Icon = InstallPackageCommand.DeleteIcon,
|
||||
Icon = Icons.DeleteIcon,
|
||||
};
|
||||
|
||||
if (WinGetStatics.AppSearchCallback != null)
|
||||
|
||||
@@ -34,17 +34,13 @@ internal sealed partial class WinGetExtensionPage : DynamicListPage, IDisposable
|
||||
|
||||
private IEnumerable<CatalogPackage>? _results;
|
||||
|
||||
public static IconInfo WinGetIcon { get; } = IconHelpers.FromRelativePath("Assets\\WinGet.svg");
|
||||
|
||||
public static IconInfo ExtensionsIcon { get; } = IconHelpers.FromRelativePath("Assets\\Extension.svg");
|
||||
|
||||
public static string ExtensionsTag => "windows-commandpalette-extension";
|
||||
|
||||
private readonly StatusMessage _errorMessage = new() { State = MessageState.Error };
|
||||
|
||||
public WinGetExtensionPage(string tag = "")
|
||||
{
|
||||
Icon = tag == ExtensionsTag ? ExtensionsIcon : WinGetIcon;
|
||||
Icon = tag == ExtensionsTag ? Icons.ExtensionsIcon : Icons.WinGetIcon;
|
||||
Name = Properties.Resources.winget_page_name;
|
||||
_tag = tag;
|
||||
ShowDetails = true;
|
||||
@@ -78,7 +74,7 @@ internal sealed partial class WinGetExtensionPage : DynamicListPage, IDisposable
|
||||
|
||||
EmptyContent = new CommandItem(new NoOpCommand())
|
||||
{
|
||||
Icon = WinGetIcon,
|
||||
Icon = Icons.WinGetIcon,
|
||||
Title = (string.IsNullOrEmpty(SearchText) && !HasTag) ?
|
||||
Properties.Resources.winget_placeholder_text :
|
||||
Properties.Resources.winget_no_packages_found,
|
||||
@@ -189,7 +185,7 @@ internal sealed partial class WinGetExtensionPage : DynamicListPage, IDisposable
|
||||
return [];
|
||||
}
|
||||
|
||||
string searchDebugText = $"{query}{(HasTag ? "+" : string.Empty)}{_tag}";
|
||||
var searchDebugText = $"{query}{(HasTag ? "+" : string.Empty)}{_tag}";
|
||||
Logger.LogDebug($"Starting search for '{searchDebugText}'");
|
||||
HashSet<CatalogPackage> results = new(new PackageIdCompare());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user