mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +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:
@@ -42,10 +42,10 @@ internal sealed class AvailableResult
|
||||
{
|
||||
return IconType switch
|
||||
{
|
||||
ResultIconType.Time => ResultHelper.TimeIcon,
|
||||
ResultIconType.Date => ResultHelper.CalendarIcon,
|
||||
ResultIconType.DateTime => ResultHelper.TimeDateIcon,
|
||||
ResultIconType.Error => ResultHelper.ErrorIcon,
|
||||
ResultIconType.Time => Icons.TimeIcon,
|
||||
ResultIconType.Date => Icons.CalendarIcon,
|
||||
ResultIconType.DateTime => Icons.TimeDateIcon,
|
||||
ResultIconType.Error => Icons.ErrorIcon,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ internal static class AvailableResultsList
|
||||
dtObject = dateTimeNowUtc;
|
||||
}
|
||||
|
||||
// Get formated date
|
||||
// Get formatted date
|
||||
var value = TimeAndDateHelper.ConvertToCustomFormat(dtObject, unixTimestamp, unixTimestampMilliseconds, weekOfYear, eraShort, Regex.Replace(formatSyntax, "^UTC:", string.Empty), firstWeekRule, firstDayOfTheWeek);
|
||||
try
|
||||
{
|
||||
|
||||
@@ -26,14 +26,6 @@ internal static class ResultHelper
|
||||
: Resources.ResourceManager.GetString(stringId + "Now", CultureInfo.CurrentUICulture) ?? string.Empty;
|
||||
}
|
||||
|
||||
public static IconInfo TimeIcon { get; } = new IconInfo("\uE823");
|
||||
|
||||
public static IconInfo CalendarIcon { get; } = new IconInfo("\uE787");
|
||||
|
||||
public static IconInfo TimeDateIcon { get; } = new IconInfo("\uEC92");
|
||||
|
||||
public static IconInfo ErrorIcon { get; } = IconHelpers.FromRelativePaths("Microsoft.CmdPal.Ext.TimeDate\\Assets\\Warning.light.png", "Microsoft.CmdPal.Ext.TimeDate\\Assets\\Warning.dark.png");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a result with an error message that input can't be parsed
|
||||
/// </summary>
|
||||
@@ -42,7 +34,7 @@ internal static class ResultHelper
|
||||
internal static ListItem CreateInvalidInputErrorResult() => new ListItem(new NoOpCommand())
|
||||
{
|
||||
Title = Resources.Microsoft_plugin_timedate_InvalidInput_ErrorMessageTitle,
|
||||
Icon = ErrorIcon,
|
||||
Icon = Icons.ErrorIcon,
|
||||
Details = new Details()
|
||||
{
|
||||
Title = Resources.Microsoft_plugin_timedate_InvalidInput_DetailsHeader,
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// 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.TimeDate;
|
||||
|
||||
internal sealed class Icons
|
||||
{
|
||||
internal static IconInfo TimeDateExtIcon { get; } = IconHelpers.FromRelativePath("Assets\\TimeDate.svg");
|
||||
|
||||
internal static IconInfo TimeIcon { get; } = new IconInfo("\uE823");
|
||||
|
||||
internal static IconInfo CalendarIcon { get; } = new IconInfo("\uE787");
|
||||
|
||||
internal static IconInfo TimeDateIcon { get; } = new IconInfo("\uEC92");
|
||||
|
||||
internal static IconInfo ErrorIcon { get; } = IconHelpers.FromRelativePaths("Microsoft.CmdPal.Ext.TimeDate\\Assets\\Warning.light.png", "Microsoft.CmdPal.Ext.TimeDate\\Assets\\Warning.dark.png");
|
||||
}
|
||||
@@ -23,7 +23,7 @@ internal sealed partial class TimeDateExtensionPage : DynamicListPage
|
||||
|
||||
public TimeDateExtensionPage(SettingsManager settingsManager)
|
||||
{
|
||||
Icon = IconHelpers.FromRelativePath("Assets\\TimeDate.svg");
|
||||
Icon = Icons.TimeDateExtIcon;
|
||||
Title = Resources.Microsoft_plugin_timedate_main_page_title;
|
||||
Name = Resources.Microsoft_plugin_timedate_main_page_name;
|
||||
PlaceholderText = Resources.Microsoft_plugin_timedate_placeholder_text;
|
||||
|
||||
Reference in New Issue
Block a user