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:
@@ -25,7 +25,7 @@ internal sealed partial class OpenServicesCommand : InvokableCommand
|
||||
{
|
||||
_serviceResult = serviceResult;
|
||||
Name = Resources.wox_plugin_service_open_services;
|
||||
Icon = new IconInfo("\xE8A7"); // OpenInNewWindow icon
|
||||
Icon = Icons.OpenIcon;
|
||||
}
|
||||
|
||||
public override CommandResult Invoke()
|
||||
|
||||
@@ -25,7 +25,7 @@ internal sealed partial class RestartServiceCommand : InvokableCommand
|
||||
{
|
||||
_serviceResult = serviceResult;
|
||||
Name = Resources.wox_plugin_service_restart;
|
||||
Icon = new IconInfo("\xE72C"); // Refresh icon
|
||||
Icon = Icons.RefreshIcon;
|
||||
}
|
||||
|
||||
public override CommandResult Invoke()
|
||||
|
||||
@@ -28,11 +28,11 @@ internal sealed partial class ServiceCommand : InvokableCommand
|
||||
Name = action.ToString();
|
||||
if (serviceResult.IsRunning)
|
||||
{
|
||||
Icon = new IconInfo("\xE71A"); // Stop icon
|
||||
Icon = Icons.StopIcon;
|
||||
}
|
||||
else
|
||||
{
|
||||
Icon = new IconInfo("\xEDB5"); // PlayBadge12 icon
|
||||
Icon = Icons.PlayIcon;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,16 +73,16 @@ public static class ServiceHelper
|
||||
];
|
||||
}
|
||||
|
||||
IconInfo icon = new("\U0001f7e2"); // unicode LARGE GREEN CIRCLE
|
||||
IconInfo icon = Icons.GreenCircleIcon;
|
||||
switch (s.Status)
|
||||
{
|
||||
case ServiceControllerStatus.Stopped:
|
||||
icon = new("\U0001F534"); // unicode LARGE RED CIRCLE
|
||||
icon = Icons.RedCircleIcon;
|
||||
break;
|
||||
case ServiceControllerStatus.Running:
|
||||
break;
|
||||
case ServiceControllerStatus.Paused:
|
||||
icon = new("\u23F8"); // unicode DOUBLE VERTICAL BAR, aka, "Pause"
|
||||
icon = Icons.PauseIcon;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
// 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 Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace Microsoft.CmdPal.Ext.WindowsServices;
|
||||
|
||||
internal sealed class Icons
|
||||
{
|
||||
internal static IconInfo ServicesIcon { get; } = IconHelpers.FromRelativePath("Assets\\Services.svg");
|
||||
|
||||
internal static IconInfo StopIcon { get; } = new IconInfo("\xE71A"); // Stop icon
|
||||
|
||||
internal static IconInfo PlayIcon { get; } = new IconInfo("\xEDB5"); // PlayBadge12 icon
|
||||
|
||||
internal static IconInfo RefreshIcon { get; } = new IconInfo("\xE72C"); // Refresh icon
|
||||
|
||||
internal static IconInfo OpenIcon { get; } = new IconInfo("\xE8A7"); // OpenInNewWindow icon
|
||||
|
||||
internal static IconInfo GreenCircleIcon { get; } = new("\U0001f7e2"); // unicode LARGE GREEN CIRCLE
|
||||
|
||||
internal static IconInfo RedCircleIcon { get; } = new("\U0001F534"); // unicode LARGE RED CIRCLE
|
||||
|
||||
internal static IconInfo PauseIcon { get; } = new("\u23F8"); // unicode DOUBLE VERTICAL BAR, aka, "Pause"
|
||||
}
|
||||
@@ -14,7 +14,7 @@ internal sealed partial class ServicesListPage : DynamicListPage
|
||||
{
|
||||
public ServicesListPage()
|
||||
{
|
||||
Icon = WindowsServicesCommandsProvider.ServicesIcon;
|
||||
Icon = Icons.ServicesIcon;
|
||||
Name = "Windows Services";
|
||||
}
|
||||
|
||||
|
||||
@@ -11,13 +11,11 @@ namespace Microsoft.CmdPal.Ext.WindowsServices;
|
||||
public partial class WindowsServicesCommandsProvider : CommandProvider
|
||||
{
|
||||
// For giggles, "%windir%\\system32\\filemgmt.dll" also _just works_.
|
||||
public static IconInfo ServicesIcon { get; } = IconHelpers.FromRelativePath("Assets\\Services.svg");
|
||||
|
||||
public WindowsServicesCommandsProvider()
|
||||
{
|
||||
Id = "Windows.Services";
|
||||
DisplayName = Resources.WindowsServicesProvider_DisplayName;
|
||||
Icon = ServicesIcon;
|
||||
Icon = Icons.ServicesIcon;
|
||||
}
|
||||
|
||||
public override ICommandItem[] TopLevelCommands()
|
||||
|
||||
Reference in New Issue
Block a user