diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/AllAppsCommandProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/AllAppsCommandProvider.cs index 6d860ee6cd..3dadba9749 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/AllAppsCommandProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/AllAppsCommandProvider.cs @@ -25,7 +25,7 @@ public partial class AllAppsCommandProvider : CommandProvider { Id = WellKnownId; DisplayName = Resources.installed_apps; - Icon = IconHelpers.FromRelativePath("Assets\\AllApps.svg"); + Icon = Icons.AllAppsIcon; Settings = AllAppsSettings.Instance.Settings; _listItem = new(Page) diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/AllAppsPage.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/AllAppsPage.cs index 46300f6bc7..4c8b5baedc 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/AllAppsPage.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/AllAppsPage.cs @@ -12,7 +12,6 @@ using System.Threading; using System.Threading.Tasks; using ManagedCommon; using Microsoft.CmdPal.Ext.Apps.Commands; -using Microsoft.CmdPal.Ext.Apps.Helpers; using Microsoft.CmdPal.Ext.Apps.Programs; using Microsoft.CmdPal.Ext.Apps.Properties; using Microsoft.CmdPal.Ext.Apps.State; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/CopyPathCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/CopyPathCommand.cs index 9618e2fa43..9fca0304aa 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/CopyPathCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/CopyPathCommand.cs @@ -6,7 +6,6 @@ using System; using System.Globalization; using System.Text; using ManagedCommon; -using Microsoft.CmdPal.Ext.Apps.Helpers; using Microsoft.CmdPal.Ext.Apps.Properties; using Microsoft.CommandPalette.Extensions.Toolkit; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/OpenInConsoleCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/OpenInConsoleCommand.cs index e4f6ec5228..2bb8d421d4 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/OpenInConsoleCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/OpenInConsoleCommand.cs @@ -6,7 +6,6 @@ using System; using System.Diagnostics; using System.Threading.Tasks; using ManagedCommon; -using Microsoft.CmdPal.Ext.Apps.Helpers; using Microsoft.CmdPal.Ext.Apps.Properties; using Microsoft.CommandPalette.Extensions.Toolkit; @@ -19,7 +18,7 @@ internal sealed partial class OpenInConsoleCommand : InvokableCommand public OpenInConsoleCommand(string target) { Name = Resources.open_path_in_console; - Icon = Icons.OpenConsoleIcon; + Icon = Icons.OpenPathIcon; _target = target; } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/OpenPathCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/OpenPathCommand.cs index 06ad9c67ce..f4c8dde29e 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/OpenPathCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/OpenPathCommand.cs @@ -4,7 +4,6 @@ using System.Diagnostics; using System.Threading.Tasks; -using Microsoft.CmdPal.Ext.Apps.Helpers; using Microsoft.CmdPal.Ext.Apps.Properties; using Microsoft.CommandPalette.Extensions.Toolkit; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/PinAppCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/PinAppCommand.cs index 6f26fde6c2..8311e36cfc 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/PinAppCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/PinAppCommand.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics.CodeAnalysis; -using Microsoft.CmdPal.Ext.Apps.Helpers; using Microsoft.CmdPal.Ext.Apps.Properties; using Microsoft.CmdPal.Ext.Apps.State; using Microsoft.CommandPalette.Extensions.Toolkit; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/RunAsAdminCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/RunAsAdminCommand.cs index d3714ea8ae..887f669454 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/RunAsAdminCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/RunAsAdminCommand.cs @@ -5,7 +5,6 @@ using System; using System.Diagnostics; using System.Threading.Tasks; -using Microsoft.CmdPal.Ext.Apps.Helpers; using Microsoft.CmdPal.Ext.Apps.Properties; using Microsoft.CmdPal.Ext.Apps.Utils; using Microsoft.CommandPalette.Extensions.Toolkit; @@ -21,7 +20,7 @@ internal sealed partial class RunAsAdminCommand : InvokableCommand public RunAsAdminCommand(string target, string parentDir, bool packaged) { Name = Resources.run_as_administrator; - Icon = Icons.RunAsIcon; + Icon = Icons.RunAsAdminIcon; _target = target; _parentDir = parentDir; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/RunAsUserCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/RunAsUserCommand.cs index 7afa8e7e13..89e2d3e8ae 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/RunAsUserCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/RunAsUserCommand.cs @@ -5,7 +5,6 @@ using System; using System.Diagnostics; using System.Threading.Tasks; -using Microsoft.CmdPal.Ext.Apps.Helpers; using Microsoft.CmdPal.Ext.Apps.Properties; using Microsoft.CmdPal.Ext.Apps.Utils; using Microsoft.CommandPalette.Extensions.Toolkit; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/UnpinAppCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/UnpinAppCommand.cs index cf829f8521..fcba03f3d3 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/UnpinAppCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/UnpinAppCommand.cs @@ -2,7 +2,6 @@ // 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.CmdPal.Ext.Apps.Helpers; using Microsoft.CmdPal.Ext.Apps.Properties; using Microsoft.CmdPal.Ext.Apps.State; using Microsoft.CommandPalette.Extensions.Toolkit; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Helpers/Icons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Helpers/Icons.cs deleted file mode 100644 index 45a10af4e5..0000000000 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Helpers/Icons.cs +++ /dev/null @@ -1,26 +0,0 @@ -// 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.Apps.Helpers; - -public static partial class Icons -{ - public static IconInfo UnpinIcon { get; } = new("\uE77A"); - - public static IconInfo PinIcon { get; } = new("\uE840"); - - public static IconInfo RunAsIcon { get; } = new("\uE7EF"); - - public static IconInfo RunAsUserIcon { get; } = new("\uE7EE"); - - public static IconInfo CopyIcon { get; } = new("\ue8c8"); - - public static IconInfo OpenConsoleIcon { get; } = new("\ue838"); - - public static IconInfo OpenPathIcon { get; } = new("\ue838"); - - public static IconInfo AllAppsIcon { get; } = IconHelpers.FromRelativePath("Assets\\AllApps.svg"); -} diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Icons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Icons.cs new file mode 100644 index 0000000000..68f46bcee1 --- /dev/null +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Icons.cs @@ -0,0 +1,24 @@ +// 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.Apps; + +internal sealed class Icons +{ + internal static IconInfo AllAppsIcon => IconHelpers.FromRelativePath("Assets\\AllApps.svg"); + + internal static IconInfo RunAsUserIcon => new("\uE7EE"); // OtherUser icon + + internal static IconInfo RunAsAdminIcon => new("\uE7EF"); // Admin icon + + internal static IconInfo OpenPathIcon => new("\ue838"); // Folder Open icon + + internal static IconInfo CopyIcon => new("\ue8c8"); // Copy icon + + public static IconInfo UnpinIcon { get; } = new("\uE77A"); // Unpin icon + + public static IconInfo PinIcon { get; } = new("\uE840"); // Pin icon +} diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Programs/UWPApplication.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Programs/UWPApplication.cs index f0f8de8a35..c5270b355c 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Programs/UWPApplication.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Programs/UWPApplication.cs @@ -106,7 +106,6 @@ public class UWPApplication : IProgram new OpenPathCommand(Location) { Name = Resources.open_containing_folder, - Icon = new("\ue838"), }) { RequestedShortcut = KeyChordHelpers.FromModifiers(ctrl: true, shift: true, vkey: VirtualKey.E), diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/AddBookmarkPage.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/AddBookmarkPage.cs index a4f9ba0050..d74b942990 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/AddBookmarkPage.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/AddBookmarkPage.cs @@ -25,7 +25,7 @@ internal sealed partial class AddBookmarkPage : ContentPage { var name = bookmark?.Name ?? string.Empty; var url = bookmark?.Bookmark ?? string.Empty; - Icon = IconHelpers.FromRelativePath("Assets\\Bookmark.svg"); + Icon = Icons.BookmarkIcon; var isAdd = string.IsNullOrEmpty(name) && string.IsNullOrEmpty(url); Title = isAdd ? Resources.bookmarks_add_title : Resources.bookmarks_edit_name; Name = isAdd ? Resources.bookmarks_add_name : Resources.bookmarks_edit_name; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/BookmarksCommandProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/BookmarksCommandProvider.cs index 7045b05867..55cd7c93a1 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/BookmarksCommandProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/BookmarksCommandProvider.cs @@ -23,15 +23,11 @@ public partial class BookmarksCommandProvider : CommandProvider private Bookmarks? _bookmarks; - public static IconInfo DeleteIcon { get; private set; } = new("\uE74D"); // Delete - - public static IconInfo EditIcon { get; private set; } = new("\uE70F"); // Edit - public BookmarksCommandProvider() { Id = "Bookmarks"; DisplayName = Resources.bookmarks_display_name; - Icon = new IconInfo("\uE718"); // Pin + Icon = Icons.PinIcon; _addNewCommand.AddedCommand += AddNewCommand_AddedCommand; } @@ -132,7 +128,7 @@ public partial class BookmarksCommandProvider : CommandProvider listItem.Subtitle = urlCommand.Url; } - var edit = new AddBookmarkPage(bookmark) { Icon = EditIcon }; + var edit = new AddBookmarkPage(bookmark) { Icon = Icons.EditIcon }; edit.AddedCommand += Edit_AddedCommand; contextMenu.Add(new CommandContextItem(edit)); @@ -153,7 +149,7 @@ public partial class BookmarksCommandProvider : CommandProvider result: CommandResult.KeepOpen()) { IsCritical = true, - Icon = DeleteIcon, + Icon = Icons.DeleteIcon, }; contextMenu.Add(delete); diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Icons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Icons.cs new file mode 100644 index 0000000000..6f8fd8b05e --- /dev/null +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Bookmark/Icons.cs @@ -0,0 +1,18 @@ +// 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.Bookmarks; + +internal sealed class Icons +{ + internal static IconInfo BookmarkIcon => IconHelpers.FromRelativePath("Assets\\Bookmark.svg"); + + internal static IconInfo DeleteIcon { get; private set; } = new("\uE74D"); // Delete + + internal static IconInfo EditIcon { get; private set; } = new("\uE70F"); // Edit + + internal static IconInfo PinIcon { get; private set; } = new IconInfo("\uE718"); // Pin +} diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/CalculatorCommandProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/CalculatorCommandProvider.cs index 1478dbbd45..0f4a8b0d9b 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/CalculatorCommandProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/CalculatorCommandProvider.cs @@ -25,7 +25,7 @@ public partial class CalculatorCommandProvider : CommandProvider { Id = "Calculator"; DisplayName = Resources.calculator_display_name; - Icon = CalculatorIcons.ProviderIcon; + Icon = Icons.CalculatorIcon; Settings = settings.Settings; } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Helper/CalculatorIcons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Helper/CalculatorIcons.cs deleted file mode 100644 index e3be5f2149..0000000000 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Helper/CalculatorIcons.cs +++ /dev/null @@ -1,18 +0,0 @@ -// 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.Calc.Helper; - -public static class CalculatorIcons -{ - public static IconInfo ResultIcon => new("\uE94E"); - - public static IconInfo SaveIcon => new("\uE74E"); - - public static IconInfo ErrorIcon => new("\uE783"); - - public static IconInfo ProviderIcon => IconHelpers.FromRelativePath("Assets\\Calculator.svg"); -} diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Helper/ErrorHandler.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Helper/ErrorHandler.cs index b3948dc854..bfcf49a556 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Helper/ErrorHandler.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Helper/ErrorHandler.cs @@ -47,7 +47,7 @@ internal static class ErrorHandler { Title = Properties.Resources.calculator_calculation_failed_title, Subtitle = errorMessage, - Icon = CalculatorIcons.ErrorIcon, + Icon = Icons.ErrorIcon, }; } } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Helper/ResultHelper.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Helper/ResultHelper.cs index 0fab0a8245..e4780e4b62 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Helper/ResultHelper.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Helper/ResultHelper.cs @@ -33,7 +33,7 @@ public static class ResultHelper return new ListItem(saveCommand) { // Using CurrentCulture since this is user facing - Icon = CalculatorIcons.ResultIcon, + Icon = Icons.ResultIcon, Title = result, Subtitle = query, TextToSuggest = result, diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Helper/SaveCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Helper/SaveCommand.cs index 850f8511e3..d2605e6f92 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Helper/SaveCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Helper/SaveCommand.cs @@ -18,7 +18,7 @@ public sealed partial class SaveCommand : InvokableCommand public SaveCommand(string result) { Name = Resources.calculator_save_command_name; - Icon = CalculatorIcons.SaveIcon; + Icon = Icons.SaveIcon; _result = result; } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Icons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Icons.cs new file mode 100644 index 0000000000..f7d1a613f1 --- /dev/null +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Icons.cs @@ -0,0 +1,18 @@ +// 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.Calc; + +internal sealed class Icons +{ + internal static IconInfo CalculatorIcon => IconHelpers.FromRelativePath("Assets\\Calculator.svg"); + + internal static IconInfo ResultIcon => new("\uE94E"); // CalculatorEqualTo icon + + internal static IconInfo SaveIcon => new("\uE74E"); // Save icon + + internal static IconInfo ErrorIcon => new("\uE783"); // Error icon +} diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Pages/CalculatorListPage.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Pages/CalculatorListPage.cs index 24f26646c5..4b0cf29d64 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Pages/CalculatorListPage.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Pages/CalculatorListPage.cs @@ -35,7 +35,7 @@ public sealed partial class CalculatorListPage : DynamicListPage public CalculatorListPage(SettingsManager settings) { _settingsManager = settings; - Icon = CalculatorIcons.ProviderIcon; + Icon = Icons.CalculatorIcon; Name = Resources.calculator_title; PlaceholderText = Resources.calculator_placeholder_text; Id = "com.microsoft.cmdpal.calculator"; @@ -43,11 +43,11 @@ public sealed partial class CalculatorListPage : DynamicListPage _emptyItem = new ListItem(new NoOpCommand()) { Title = Resources.calculator_placeholder_text, - Icon = CalculatorIcons.ResultIcon, + Icon = Icons.ResultIcon, }; EmptyContent = new CommandItem(new NoOpCommand()) { - Icon = CalculatorIcons.ProviderIcon, + Icon = Icons.CalculatorIcon, Title = Resources.calculator_placeholder_text, }; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Pages/FallbackCalculatorItem.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Pages/FallbackCalculatorItem.cs index 05d047924c..10d305bb7c 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Pages/FallbackCalculatorItem.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/Pages/FallbackCalculatorItem.cs @@ -20,7 +20,7 @@ public sealed partial class FallbackCalculatorItem : FallbackCommandItem _copyCommand.Name = string.Empty; Title = string.Empty; Subtitle = Resources.calculator_placeholder_text; - Icon = CalculatorIcons.ProviderIcon; + Icon = Icons.CalculatorIcon; _settings = settings; } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/ClipboardHistoryCommandsProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/ClipboardHistoryCommandsProvider.cs index d04126a453..c15658c96c 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/ClipboardHistoryCommandsProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/ClipboardHistoryCommandsProvider.cs @@ -18,11 +18,11 @@ public partial class ClipboardHistoryCommandsProvider : CommandProvider { Title = Properties.Resources.list_item_title, Subtitle = Properties.Resources.list_item_subtitle, - Icon = Icons.ClipboardList, + Icon = Icons.ClipboardListIcon, }; DisplayName = Properties.Resources.provider_display_name; - Icon = Icons.ClipboardList; + Icon = Icons.ClipboardListIcon; Id = "Windows.ClipboardHistory"; } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Commands/CopyCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Commands/CopyCommand.cs index 37b00d2ed7..d55f87c9c6 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Commands/CopyCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Commands/CopyCommand.cs @@ -19,11 +19,11 @@ internal sealed partial class CopyCommand : InvokableCommand Name = Properties.Resources.copy_command_name; if (clipboardFormat == ClipboardFormat.Text) { - Icon = Icons.Copy; + Icon = Icons.CopyIcon; } else { - Icon = Icons.Picture; + Icon = Icons.PictureIcon; } } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Commands/PasteCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Commands/PasteCommand.cs index b60c0ecd02..87f5fe1633 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Commands/PasteCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Commands/PasteCommand.cs @@ -20,7 +20,7 @@ internal sealed partial class PasteCommand : InvokableCommand _clipboardItem = clipboardItem; _clipboardFormat = clipboardFormat; Name = Properties.Resources.paste_command_name; - Icon = Icons.Paste; + Icon = Icons.PasteIcon; } private void HideWindow() diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Icons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Icons.cs index 15c90a857b..38fbc06d07 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Icons.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Icons.cs @@ -8,11 +8,11 @@ namespace Microsoft.CmdPal.Ext.ClipboardHistory; internal sealed class Icons { - internal static IconInfo Copy { get; } = new("\xE8C8"); + internal static IconInfo CopyIcon { get; } = new("\xE8C8"); - internal static IconInfo Picture { get; } = new("\xE8B9"); + internal static IconInfo PictureIcon { get; } = new("\xE8B9"); - internal static IconInfo Paste { get; } = new("\uE77F"); + internal static IconInfo PasteIcon { get; } = new("\uE77F"); - internal static IconInfo ClipboardList { get; } = new("\uF0E3"); + internal static IconInfo ClipboardListIcon { get; } = new("\uF0E3"); } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Pages/ClipboardHistoryListPage.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Pages/ClipboardHistoryListPage.cs index fed78fa32c..b8cccb987b 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Pages/ClipboardHistoryListPage.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.ClipboardHistory/Pages/ClipboardHistoryListPage.cs @@ -24,7 +24,7 @@ internal sealed partial class ClipboardHistoryListPage : ListPage { clipboardHistory = []; _defaultIconPath = string.Empty; - Icon = Icons.ClipboardList; + Icon = Icons.ClipboardListIcon; Name = Properties.Resources.clipboard_history_page_name; Id = "com.microsoft.cmdpal.clipboardHistory"; ShowDetails = true; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Commands/OpenFileCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Commands/OpenFileCommand.cs index 478f03ef3a..9d48c64376 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Commands/OpenFileCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Commands/OpenFileCommand.cs @@ -19,7 +19,7 @@ internal sealed partial class OpenFileCommand : InvokableCommand { this._item = item; this.Name = Resources.Indexer_Command_OpenFile; - this.Icon = Icons.OpenFile; + this.Icon = Icons.OpenFileIcon; } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/FallbackOpenFileItem.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/FallbackOpenFileItem.cs index a123200b8c..c1f867a4f3 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/FallbackOpenFileItem.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/FallbackOpenFileItem.cs @@ -28,7 +28,7 @@ internal sealed partial class FallbackOpenFileItem : FallbackCommandItem, System { Title = string.Empty; Subtitle = string.Empty; - Icon = Icons.FileExplorer; + Icon = Icons.FileExplorerIcon; } public override void UpdateQuery(string query) @@ -106,7 +106,7 @@ internal sealed partial class FallbackOpenFileItem : FallbackCommandItem, System // us to the file search page, prepopulated with this search. var indexerPage = new IndexerPage(query, _searchEngine, _queryCookie, results); Title = string.Format(CultureInfo.CurrentCulture, fallbackItemSearchPageTitleCompositeFormat, query); - Icon = Icons.FileExplorer; + Icon = Icons.FileExplorerIcon; Subtitle = Resources.Indexer_Subtitle; Command = indexerPage; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Icons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Icons.cs new file mode 100644 index 0000000000..f57b8a2d07 --- /dev/null +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Icons.cs @@ -0,0 +1,22 @@ +// 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.Indexer; + +internal sealed class Icons +{ + internal static IconInfo FileExplorerSegoeIcon { get; } = new("\uEC50"); + + internal static IconInfo FileExplorerIcon { get; } = IconHelpers.FromRelativePath("Assets\\FileExplorer.png"); + + internal static IconInfo ActionsIcon { get; } = IconHelpers.FromRelativePath("Assets\\Actions.png"); + + internal static IconInfo OpenFileIcon { get; } = new("\uE8E5"); // OpenFile + + internal static IconInfo DocumentIcon { get; } = new("\uE8A5"); // Document + + internal static IconInfo FolderOpenIcon { get; } = new("\uE838"); // FolderOpen +} diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/IndexerCommandsProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/IndexerCommandsProvider.cs index 605e3c70ff..ab6584f673 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/IndexerCommandsProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/IndexerCommandsProvider.cs @@ -18,7 +18,7 @@ public partial class IndexerCommandsProvider : CommandProvider { Id = "Files"; DisplayName = Resources.IndexerCommandsProvider_DisplayName; - Icon = Icons.FileExplorer; + Icon = Icons.FileExplorerIcon; if (IndexerListItem.IsActionsFeatureEnabled && ApiInformation.IsApiContractPresent("Windows.AI.Actions.ActionsContract", 4)) { diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/ActionsListContextItem.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/ActionsListContextItem.cs index 04f9df00f4..0c2823fed5 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/ActionsListContextItem.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/ActionsListContextItem.cs @@ -27,7 +27,7 @@ internal sealed partial class ActionsListContextItem : CommandContextItem, IDisp : base(new NoOpCommand()) { Title = Resources.Indexer_Command_Actions; - Icon = Icons.Actions; + Icon = Icons.ActionsIcon; RequestedShortcut = KeyChordHelpers.FromModifiers(alt: true, vkey: VirtualKey.A); this.fullPath = fullPath; UpdateMoreCommands(); diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/DirectoryExplorePage.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/DirectoryExplorePage.cs index 531398685b..9bb7820a07 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/DirectoryExplorePage.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/DirectoryExplorePage.cs @@ -28,7 +28,7 @@ public sealed partial class DirectoryExplorePage : DynamicListPage public DirectoryExplorePage(string path) { _path = path; - Icon = Icons.FileExplorer; + Icon = Icons.FileExplorerIcon; Name = Resources.Indexer_Command_Browse; Title = path; } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/DirectoryPage.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/DirectoryPage.cs index e71b8a089a..a6f989c41e 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/DirectoryPage.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/DirectoryPage.cs @@ -24,7 +24,7 @@ public sealed partial class DirectoryPage : ListPage public DirectoryPage(string path) { _path = path; - Icon = Icons.FileExplorer; + Icon = Icons.FileExplorerIcon; Name = Resources.Indexer_Command_Browse; Title = path; } @@ -52,7 +52,7 @@ public sealed partial class DirectoryPage : ListPage EmptyContent = new CommandItem( title: Resources.Indexer_File_Is_File_Not_Folder, subtitle: $"{_path}") { - Icon = Icons.Document, + Icon = Icons.DocumentIcon, }; return []; } @@ -66,7 +66,7 @@ public sealed partial class DirectoryPage : ListPage EmptyContent = new CommandItem( title: Resources.Indexer_Folder_Is_Empty, subtitle: $"{_path}") { - Icon = Icons.FolderOpen, + Icon = Icons.FolderOpenIcon, Command = listItemForUs.Command, MoreCommands = listItemForUs.MoreCommands, }; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/Icons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/Icons.cs deleted file mode 100644 index a07bce2016..0000000000 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/Icons.cs +++ /dev/null @@ -1,22 +0,0 @@ -// 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.Indexer; - -internal sealed class Icons -{ - internal static IconInfo FileExplorerSegoe { get; } = new("\uEC50"); - - internal static IconInfo FileExplorer { get; } = IconHelpers.FromRelativePath("Assets\\FileExplorer.png"); - - internal static IconInfo Actions { get; } = IconHelpers.FromRelativePath("Assets\\Actions.png"); - - internal static IconInfo OpenFile { get; } = new("\uE8E5"); // OpenFile - - internal static IconInfo Document { get; } = new("\uE8A5"); // Document - - internal static IconInfo FolderOpen { get; } = new("\uE838"); // FolderOpen -} diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/IndexerPage.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/IndexerPage.cs index 33938b21e4..a62f03295a 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/IndexerPage.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/IndexerPage.cs @@ -24,7 +24,7 @@ internal sealed partial class IndexerPage : DynamicListPage, IDisposable public IndexerPage() { Id = "com.microsoft.indexer.fileSearch"; - Icon = Icons.FileExplorer; + Icon = Icons.FileExplorerIcon; Name = Resources.Indexer_Title; PlaceholderText = Resources.Indexer_PlaceholderText; _searchEngine = new(); @@ -33,7 +33,7 @@ internal sealed partial class IndexerPage : DynamicListPage, IDisposable public IndexerPage(string query, SearchEngine searchEngine, uint queryCookie, IList firstPageData) { - Icon = Icons.FileExplorer; + Icon = Icons.FileExplorerIcon; Name = Resources.Indexer_Title; _searchEngine = searchEngine; _queryCookie = queryCookie; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Commands/CopyRegistryInfoCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Commands/CopyRegistryInfoCommand.cs index d876eb7efc..2252c4c1fe 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Commands/CopyRegistryInfoCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Commands/CopyRegistryInfoCommand.cs @@ -21,19 +21,19 @@ internal sealed partial class CopyRegistryInfoCommand : InvokableCommand if (typeToCopy == CopyType.Key) { Name = Resources.CopyKeyNamePath; - Icon = new IconInfo("\xE8C8"); // Copy Icon + Icon = Icons.CopyIcon; _stringToCopy = entry.GetRegistryKey(); } else if (typeToCopy == CopyType.ValueData) { Name = Resources.CopyValueData; - Icon = new IconInfo("\xF413"); // CopyTo Icon + Icon = Icons.CopyToIcon; _stringToCopy = entry.GetValueData(); } else if (typeToCopy == CopyType.ValueName) { Name = Resources.CopyValueName; - Icon = new IconInfo("\xE8C8"); // Copy Icon + Icon = Icons.CopyIcon; _stringToCopy = entry.GetValueNameWithKey(); } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Commands/OpenKeyInEditorCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Commands/OpenKeyInEditorCommand.cs index b963c051bf..855b55b37d 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Commands/OpenKeyInEditorCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Commands/OpenKeyInEditorCommand.cs @@ -27,7 +27,7 @@ internal sealed partial class OpenKeyInEditorCommand : InvokableCommand internal OpenKeyInEditorCommand(RegistryEntry entry) { Name = Resources.OpenKeyInRegistryEditor; - Icon = new IconInfo("\xE8A7"); // OpenInNewWindow icon + Icon = Icons.OpenInNewWindowIcon; _entry = entry; } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Helpers/ResultHelper.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Helpers/ResultHelper.cs index d607ce6b23..c05af5f594 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Helpers/ResultHelper.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Helpers/ResultHelper.cs @@ -101,7 +101,7 @@ internal static class ResultHelper resultList.Add(new ListItem(new OpenKeyInEditorCommand(registryEntry)) { - Icon = RegistryListPage.RegistryIcon, + Icon = Icons.RegistryIcon, Subtitle = GetTruncatedText(valueException.Message, MaxTextLength.MaximumSubTitleLengthWithThreeSymbols, TruncateSide.OnlyFromRight), Title = GetTruncatedText(key.Name, MaxTextLength.MaximumTitleLengthWithThreeSymbols), MoreCommands = ContextMenuHelper.GetContextMenu(registryEntry).ToArray(), @@ -130,7 +130,7 @@ internal static class ResultHelper resultList.Add(new ListItem(new OpenKeyInEditorCommand(registryEntry)) { - Icon = RegistryListPage.RegistryIcon, + Icon = Icons.RegistryIcon, Subtitle = GetTruncatedText(GetSubTileForRegistryValue(key, valueEntry), MaxTextLength.MaximumSubTitleLengthWithThreeSymbols, TruncateSide.OnlyFromRight), Title = GetTruncatedText(valueName, MaxTextLength.MaximumTitleLengthWithThreeSymbols), MoreCommands = ContextMenuHelper.GetContextMenu(registryEntry).ToArray(), @@ -145,7 +145,7 @@ internal static class ResultHelper resultList.Add(new ListItem(new OpenKeyInEditorCommand(registryEntry)) { - Icon = RegistryListPage.RegistryIcon, + Icon = Icons.RegistryIcon, Subtitle = GetTruncatedText(exception.Message, MaxTextLength.MaximumSubTitleLengthWithThreeSymbols, TruncateSide.OnlyFromRight), Title = GetTruncatedText(key.Name, MaxTextLength.MaximumTitleLengthWithThreeSymbols), }); diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Icons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Icons.cs new file mode 100644 index 0000000000..7e77abc757 --- /dev/null +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Icons.cs @@ -0,0 +1,18 @@ +// 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.Registry; + +internal sealed class Icons +{ + internal static IconInfo RegistryIcon { get; } = IconHelpers.FromRelativePath("Assets\\Registry.svg"); + + internal static IconInfo OpenInNewWindowIcon { get; } = new IconInfo("\xE8A7"); // OpenInNewWindow icon + + internal static IconInfo CopyIcon { get; } = new IconInfo("\xE8C8"); // Copy icon + + internal static IconInfo CopyToIcon { get; } = new IconInfo("\xF413"); // CopyTo Icon +} diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Pages/RegistryListPage.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Pages/RegistryListPage.cs index 34ca4e5d21..fbc80d5d1e 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Pages/RegistryListPage.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/Pages/RegistryListPage.cs @@ -21,12 +21,12 @@ internal sealed partial class RegistryListPage : DynamicListPage public RegistryListPage() { - Icon = IconHelpers.FromRelativePath("Assets\\Registry.svg"); + Icon = Icons.RegistryIcon; Name = Title = Resources.Registry_Page_Title; Id = "com.microsoft.cmdpal.registry"; _emptyMessage = new CommandItem() { - Icon = IconHelpers.FromRelativePath("Assets\\Registry.svg"), + Icon = Icons.RegistryIcon, Title = Resources.Registry_Key_Not_Found, Subtitle = SearchText, }; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/RegistryCommandsProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/RegistryCommandsProvider.cs index cca02e8d77..3f4218c81b 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/RegistryCommandsProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Registry/RegistryCommandsProvider.cs @@ -14,7 +14,7 @@ public partial class RegistryCommandsProvider : CommandProvider { Id = "Windows.Registry"; DisplayName = Resources.RegistryProvider_DisplayName; - Icon = IconHelpers.FromRelativePath("Assets\\Registry.svg"); + Icon = Icons.RegistryIcon; } public override ICommandItem[] TopLevelCommands() diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/Commands/ExecuteItem.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/Commands/ExecuteItem.cs index 3bc1ec09d7..74ef0268de 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/Commands/ExecuteItem.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/Commands/ExecuteItem.cs @@ -26,17 +26,17 @@ internal sealed partial class ExecuteItem : InvokableCommand if (type == RunAsType.Administrator) { Name = Properties.Resources.cmd_run_as_administrator; - Icon = new IconInfo("\xE7EF"); // Admin Icon + Icon = Icons.AdminIcon; } else if (type == RunAsType.OtherUser) { Name = Properties.Resources.cmd_run_as_user; - Icon = new IconInfo("\xE7EE"); // User Icon + Icon = Icons.UserIcon; } else { Name = Properties.Resources.generic_run_command; - Icon = new IconInfo("\uE751"); // Return Key Icon + Icon = Icons.ReturnIcon; } Cmd = cmd; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/FallbackExecuteItem.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/FallbackExecuteItem.cs index d4fd919a95..437fbcbdf6 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/FallbackExecuteItem.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/FallbackExecuteItem.cs @@ -24,7 +24,7 @@ internal sealed partial class FallbackExecuteItem : FallbackCommandItem Title = string.Empty; _executeItem.Name = string.Empty; Subtitle = Properties.Resources.generic_run_command; - Icon = Icons.RunV2; // Defined in Icons.cs and contains the execute command icon. + Icon = Icons.RunV2Icon; // Defined in Icons.cs and contains the execute command icon. } public override void UpdateQuery(string query) diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/Helpers/ShellListPageHelpers.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/Helpers/ShellListPageHelpers.cs index 204a2cc5da..1bb682f6bd 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/Helpers/ShellListPageHelpers.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/Helpers/ShellListPageHelpers.cs @@ -55,7 +55,7 @@ public class ShellListPageHelpers // Using CurrentCulture since this is user facing Subtitle = Properties.Resources.cmd_plugin_name + ": " + string.Format(CultureInfo.CurrentCulture, CmdHasBeenExecutedTimes, m.Value), - Icon = new IconInfo("\uE81C"), + Icon = Icons.HistoryIcon, }; return ret; }).Where(o => o != null).Take(4); @@ -108,7 +108,7 @@ public class ShellListPageHelpers // Using CurrentCulture since this is user facing Subtitle = Properties.Resources.cmd_plugin_name + ": " + string.Format(CultureInfo.CurrentCulture, CmdHasBeenExecutedTimes, m.Value), - Icon = new IconInfo("\uE81C"), + Icon = Icons.HistoryIcon, }).Take(5); return history.ToList(); diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/Icons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/Icons.cs index 7586d466fd..b25d53a6c5 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/Icons.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/Icons.cs @@ -8,5 +8,13 @@ namespace Microsoft.CmdPal.Ext.Shell; internal sealed class Icons { - internal static IconInfo RunV2 { get; } = IconHelpers.FromRelativePath("Assets\\Run.svg"); + internal static IconInfo RunV2Icon { get; } = IconHelpers.FromRelativePath("Assets\\Run.svg"); + + internal static IconInfo HistoryIcon { get; } = new IconInfo("\uE81C"); // History + + internal static IconInfo AdminIcon { get; } = new IconInfo("\xE7EF"); // Admin Icon + + internal static IconInfo UserIcon { get; } = new IconInfo("\xE7EE"); // User Icon + + internal static IconInfo ReturnIcon { get; } = new IconInfo("\uE751"); // Return Key Icon } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/Pages/ShellListPage.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/Pages/ShellListPage.cs index 51f6f8e636..d817809e10 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/Pages/ShellListPage.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/Pages/ShellListPage.cs @@ -15,7 +15,7 @@ internal sealed partial class ShellListPage : DynamicListPage public ShellListPage(SettingsManager settingsManager) { - Icon = Icons.RunV2; + Icon = Icons.RunV2Icon; Id = "com.microsoft.cmdpal.shell"; Name = Resources.cmd_plugin_name; PlaceholderText = Resources.list_placeholder_text; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/ShellCommandsProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/ShellCommandsProvider.cs index 9e98e036d4..1abc3c9d1c 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/ShellCommandsProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/ShellCommandsProvider.cs @@ -20,14 +20,14 @@ public partial class ShellCommandsProvider : CommandProvider { Id = "Run"; DisplayName = Resources.cmd_plugin_name; - Icon = Icons.RunV2; + Icon = Icons.RunV2Icon; Settings = _settingsManager.Settings; _fallbackItem = new FallbackExecuteItem(_settingsManager); _shellPageItem = new CommandItem(new ShellListPage(_settingsManager)) { - Icon = Icons.RunV2, + Icon = Icons.RunV2Icon, Title = Resources.shell_command_name, Subtitle = Resources.cmd_plugin_description, MoreCommands = [ diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.System/Helpers/Icons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.System/Helpers/Icons.cs deleted file mode 100644 index 313ba773f8..0000000000 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.System/Helpers/Icons.cs +++ /dev/null @@ -1,28 +0,0 @@ -// 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.System.Helpers; - -public static partial class Icons -{ - public static IconInfo FirmwareSettingsIcon { get; } = new IconInfo("\uE950"); - - public static IconInfo LockIcon { get; } = new IconInfo("\uE72E"); - - public static IconInfo LogoffIcon { get; } = new IconInfo("\uF3B1"); - - public static IconInfo NetworkAdapterIcon { get; } = new IconInfo("\uEDA3"); - - public static IconInfo RecycleBinIcon { get; } = new IconInfo("\uE74D"); - - public static IconInfo RestartIcon { get; } = new IconInfo("\uE777"); - - public static IconInfo RestartShellIcon { get; } = new IconInfo("\uEC50"); - - public static IconInfo ShutdownIcon { get; } = new IconInfo("\uE7E8"); - - public static IconInfo SleepIcon { get; } = new IconInfo("\uE708"); -} diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.System/Icons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.System/Icons.cs new file mode 100644 index 0000000000..9993220dee --- /dev/null +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.System/Icons.cs @@ -0,0 +1,28 @@ +// 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.System; + +internal sealed class Icons +{ + internal static IconInfo FirmwareSettingsIcon { get; } = new IconInfo("\uE950"); + + internal static IconInfo LockIcon { get; } = new IconInfo("\uE72E"); + + internal static IconInfo LogoffIcon { get; } = new IconInfo("\uF3B1"); + + internal static IconInfo NetworkAdapterIcon { get; } = new IconInfo("\uEDA3"); + + internal static IconInfo RecycleBinIcon { get; } = new IconInfo("\uE74D"); + + internal static IconInfo RestartIcon { get; } = new IconInfo("\uE777"); + + internal static IconInfo RestartShellIcon { get; } = new IconInfo("\uEC50"); + + internal static IconInfo ShutdownIcon { get; } = new IconInfo("\uE7E8"); + + internal static IconInfo SleepIcon { get; } = new IconInfo("\uE708"); +} diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Helpers/AvailableResult.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Helpers/AvailableResult.cs index 7665de85df..3f54ca8438 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Helpers/AvailableResult.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Helpers/AvailableResult.cs @@ -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, }; } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Helpers/AvailableResultsList.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Helpers/AvailableResultsList.cs index ee14fdb855..38366345c4 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Helpers/AvailableResultsList.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Helpers/AvailableResultsList.cs @@ -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 { diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Helpers/ResultHelper.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Helpers/ResultHelper.cs index e2ba932743..896bbd6b84 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Helpers/ResultHelper.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Helpers/ResultHelper.cs @@ -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"); - /// /// Gets a result with an error message that input can't be parsed /// @@ -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, diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Icons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Icons.cs new file mode 100644 index 0000000000..e0464b780f --- /dev/null +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Icons.cs @@ -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"); +} diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Pages/TimeDateExtensionPage.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Pages/TimeDateExtensionPage.cs index ddacc95a62..4eb95034b7 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Pages/TimeDateExtensionPage.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/Pages/TimeDateExtensionPage.cs @@ -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; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/Commands/OpenURLCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/Commands/OpenURLCommand.cs index fd3f3a8f18..08d0a114f5 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/Commands/OpenURLCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/Commands/OpenURLCommand.cs @@ -2,7 +2,6 @@ // 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.CmdPal.Ext.WebSearch.Helpers; using Microsoft.CommandPalette.Extensions.Toolkit; using BrowserInfo = Microsoft.CmdPal.Ext.WebSearch.Helpers.DefaultBrowserInfo; @@ -11,17 +10,14 @@ namespace Microsoft.CmdPal.Ext.WebSearch.Commands; internal sealed partial class OpenURLCommand : InvokableCommand { - private readonly SettingsManager _settingsManager; - public string Url { get; internal set; } = string.Empty; - internal OpenURLCommand(string url, SettingsManager settingsManager) + internal OpenURLCommand(string url) { Url = url; BrowserInfo.UpdateIfTimePassed(); - Icon = IconHelpers.FromRelativePath("Assets\\WebSearch.png"); + Icon = Icons.WebSearch; Name = string.Empty; - _settingsManager = settingsManager; } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/Commands/SearchWebCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/Commands/SearchWebCommand.cs index 0dc0265a7d..1004f151a3 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/Commands/SearchWebCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/Commands/SearchWebCommand.cs @@ -21,7 +21,7 @@ internal sealed partial class SearchWebCommand : InvokableCommand { Arguments = arguments; BrowserInfo.UpdateIfTimePassed(); - Icon = IconHelpers.FromRelativePath("Assets\\WebSearch.png"); + Icon = Icons.WebSearch; Name = Properties.Resources.open_in_default_browser; _settingsManager = settingsManager; } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/FallbackExecuteSearchItem.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/FallbackExecuteSearchItem.cs index 9f37a7bf7e..bc87227221 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/FallbackExecuteSearchItem.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/FallbackExecuteSearchItem.cs @@ -23,7 +23,7 @@ internal sealed partial class FallbackExecuteSearchItem : FallbackCommandItem Title = string.Empty; _executeItem.Name = string.Empty; Subtitle = string.Format(CultureInfo.CurrentCulture, PluginOpen, BrowserInfo.Name ?? BrowserInfo.MSEdgeName); - Icon = IconHelpers.FromRelativePath("Assets\\WebSearch.png"); + Icon = Icons.WebSearch; } public override void UpdateQuery(string query) diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/FallbackOpenURLItem.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/FallbackOpenURLItem.cs index 45a65f4902..9f5d9d86ca 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/FallbackOpenURLItem.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/FallbackOpenURLItem.cs @@ -19,13 +19,13 @@ internal sealed partial class FallbackOpenURLItem : FallbackCommandItem private static readonly CompositeFormat PluginOpenUrlInBrowser = System.Text.CompositeFormat.Parse(Properties.Resources.plugin_open_url_in_browser); public FallbackOpenURLItem(SettingsManager settings) - : base(new OpenURLCommand(string.Empty, settings), Properties.Resources.open_url_fallback_title) + : base(new OpenURLCommand(string.Empty), Properties.Resources.open_url_fallback_title) { _executeItem = (OpenURLCommand)this.Command!; Title = string.Empty; _executeItem.Name = string.Empty; Subtitle = string.Empty; - Icon = IconHelpers.FromRelativePath("Assets\\WebSearch.png"); + Icon = Icons.WebSearch; } public override void UpdateQuery(string query) diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/Icons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/Icons.cs new file mode 100644 index 0000000000..10f6fd32c1 --- /dev/null +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/Icons.cs @@ -0,0 +1,12 @@ +// 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.WebSearch; + +internal sealed class Icons +{ + internal static IconInfo WebSearch { get; } = IconHelpers.FromRelativePath("Assets\\WebSearch.png"); +} diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/WebSearchCommandsProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/WebSearchCommandsProvider.cs index 6768ff8baf..cb2d2ccf1b 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/WebSearchCommandsProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/WebSearchCommandsProvider.cs @@ -20,7 +20,7 @@ public partial class WebSearchCommandsProvider : CommandProvider { Id = "WebSearch"; DisplayName = Resources.extension_name; - Icon = IconHelpers.FromRelativePath("Assets\\WebSearch.png"); + Icon = Icons.WebSearch; Settings = _settingsManager.Settings; _fallbackItem = new FallbackExecuteSearchItem(_settingsManager); diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/WebSearchTopLevelCommandItem.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/WebSearchTopLevelCommandItem.cs index d1d2e5ccad..e13436845d 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/WebSearchTopLevelCommandItem.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/WebSearchTopLevelCommandItem.cs @@ -20,7 +20,7 @@ public partial class WebSearchTopLevelCommandItem : CommandItem, IFallbackHandle public WebSearchTopLevelCommandItem(SettingsManager settingsManager) : base(new WebSearchListPage(settingsManager)) { - Icon = IconHelpers.FromRelativePath("Assets\\WebSearch.png"); + Icon = Icons.WebSearch; SetDefaultTitle(); _settingsManager = settingsManager; } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/Icons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/Icons.cs new file mode 100644 index 0000000000..524bc25581 --- /dev/null +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/Icons.cs @@ -0,0 +1,24 @@ +// 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.WinGet; + +internal sealed class Icons +{ + internal static IconInfo WinGetIcon { get; } = IconHelpers.FromRelativePath("Assets\\WinGet.svg"); + + internal static IconInfo ExtensionsIcon { get; } = IconHelpers.FromRelativePath("Assets\\Extension.svg"); + + internal static IconInfo StoreIcon { get; } = IconHelpers.FromRelativePaths("Assets\\Store.light.svg", "Assets\\Store.dark.svg"); + + internal static IconInfo CompletedIcon { get; } = new("\uE930"); // Completed + + internal static IconInfo UpdateIcon { get; } = new("\uE74A"); // Up + + internal static IconInfo DownloadIcon { get; } = new("\uE896"); // Download + + internal static IconInfo DeleteIcon { get; } = new("\uE74D"); // Delete +} diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/Pages/InstallPackageCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/Pages/InstallPackageCommand.cs index cf85359bdf..c4fd7b7a4c 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/Pages/InstallPackageCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/Pages/InstallPackageCommand.cs @@ -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? 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 diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/Pages/InstallPackageListItem.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/Pages/InstallPackageListItem.cs index 8156095d85..dd51e297a9 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/Pages/InstallPackageListItem.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/Pages/InstallPackageListItem.cs @@ -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) diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/Pages/WinGetExtensionPage.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/Pages/WinGetExtensionPage.cs index 000e2a9bba..1ca113d55c 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/Pages/WinGetExtensionPage.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/Pages/WinGetExtensionPage.cs @@ -34,17 +34,13 @@ internal sealed partial class WinGetExtensionPage : DynamicListPage, IDisposable private IEnumerable? _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 results = new(new PackageIdCompare()); diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/WinGetExtensionCommandsProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/WinGetExtensionCommandsProvider.cs index 28586b07ee..44b6da1f17 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/WinGetExtensionCommandsProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WinGet/WinGetExtensionCommandsProvider.cs @@ -15,7 +15,7 @@ public partial class WinGetExtensionCommandsProvider : CommandProvider { DisplayName = Properties.Resources.winget_display_name; Id = "WinGet"; - Icon = WinGetExtensionPage.WinGetIcon; + Icon = Icons.WinGetIcon; _ = WinGetStatics.Manager; } @@ -34,7 +34,7 @@ public partial class WinGetExtensionCommandsProvider : CommandProvider new OpenUrlCommand("ms-windows-store://assoc/?Tags=AppExtension-com.microsoft.commandpalette")) { Title = Properties.Resources.winget_search_store_title, - Icon = IconHelpers.FromRelativePaths("Assets\\Store.light.svg", "Assets\\Store.dark.svg"), + Icon = Icons.StoreIcon, }, ]; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Commands/CloseWindowCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Commands/CloseWindowCommand.cs index aa4ee84a5d..ea2480918c 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Commands/CloseWindowCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Commands/CloseWindowCommand.cs @@ -20,7 +20,7 @@ internal sealed partial class CloseWindowCommand : InvokableCommand public CloseWindowCommand(Window window) { - Icon = new IconInfo("\uE894"); + Icon = Icons.CloseWindow; Name = $"{Resources.windowwalker_Close}"; _window = window; } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Commands/EndTaskCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Commands/EndTaskCommand.cs index 0918d6bc02..993429d305 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Commands/EndTaskCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Commands/EndTaskCommand.cs @@ -21,7 +21,7 @@ internal sealed partial class EndTaskCommand : InvokableCommand public EndTaskCommand(Window window) { - Icon = new IconInfo("\uF140"); + Icon = Icons.EndTask; Name = $"{Resources.windowwalker_Kill}"; _window = window; } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Components/ResultHelper.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Components/ResultHelper.cs index 092f1544de..fd7cf9149c 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Components/ResultHelper.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Components/ResultHelper.cs @@ -119,7 +119,7 @@ internal static class ResultHelper return new WindowWalkerListItem(null) { Title = Resources.windowwalker_ExplorerInfoTitle, - Icon = new IconInfo("\uE946"), // Info + Icon = Icons.Info, Subtitle = Resources.windowwalker_ExplorerInfoSubTitle, Command = new ExplorerInfoResultCommand(), }; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Icons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Icons.cs new file mode 100644 index 0000000000..bfcb47f428 --- /dev/null +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Icons.cs @@ -0,0 +1,18 @@ +// 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.WindowWalker; + +internal sealed class Icons +{ + internal static IconInfo WindowWalkerIcon { get; } = IconHelpers.FromRelativePath("Assets\\WindowWalker.svg"); + + internal static IconInfo EndTask { get; } = new IconInfo("\uF140"); // StatusCircleBlock + + internal static IconInfo CloseWindow { get; } = new IconInfo("\uE894"); // Clear + + internal static IconInfo Info { get; } = new IconInfo("\uE946"); // Info +} diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Pages/WindowWalkerListPage.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Pages/WindowWalkerListPage.cs index 96556d8fd5..ff7217498a 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Pages/WindowWalkerListPage.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Pages/WindowWalkerListPage.cs @@ -19,7 +19,7 @@ internal sealed partial class WindowWalkerListPage : DynamicListPage, IDisposabl public WindowWalkerListPage() { - Icon = IconHelpers.FromRelativePath("Assets\\WindowWalker.svg"); + Icon = Icons.WindowWalkerIcon; Name = Resources.windowwalker_name; Id = "com.microsoft.cmdpal.windowwalker"; PlaceholderText = Resources.windowwalker_PlaceholderText; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/WindowWalkerCommandsProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/WindowWalkerCommandsProvider.cs index a1dd46cad1..5b9bc79c9c 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/WindowWalkerCommandsProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/WindowWalkerCommandsProvider.cs @@ -20,7 +20,7 @@ public partial class WindowWalkerCommandsProvider : CommandProvider { Id = "WindowWalker"; DisplayName = Resources.windowwalker_name; - Icon = IconHelpers.FromRelativePath("Assets\\WindowWalker.svg"); + Icon = Icons.WindowWalkerIcon; Settings = SettingsManager.Instance.Settings; _windowWalkerPageItem = new CommandItem(new WindowWalkerListPage()) diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Commands/OpenServicesCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Commands/OpenServicesCommand.cs index 312a3fc33d..8c7e952ce6 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Commands/OpenServicesCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Commands/OpenServicesCommand.cs @@ -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() diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Commands/RestartServiceCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Commands/RestartServiceCommand.cs index 48b2a861ee..882697acf2 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Commands/RestartServiceCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Commands/RestartServiceCommand.cs @@ -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() diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Commands/ServiceCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Commands/ServiceCommand.cs index 3d313fe656..ffde320363 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Commands/ServiceCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Commands/ServiceCommand.cs @@ -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; } } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Helpers/ServiceHelper.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Helpers/ServiceHelper.cs index e5d81caa3c..ed67163ca5 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Helpers/ServiceHelper.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Helpers/ServiceHelper.cs @@ -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; } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Icons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Icons.cs new file mode 100644 index 0000000000..91ac6cb779 --- /dev/null +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Icons.cs @@ -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" +} diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Pages/ServicesListPage.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Pages/ServicesListPage.cs index 1d7b4d43f1..1f361b6b10 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Pages/ServicesListPage.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/Pages/ServicesListPage.cs @@ -14,7 +14,7 @@ internal sealed partial class ServicesListPage : DynamicListPage { public ServicesListPage() { - Icon = WindowsServicesCommandsProvider.ServicesIcon; + Icon = Icons.ServicesIcon; Name = "Windows Services"; } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/WindowsServicesCommandsProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/WindowsServicesCommandsProvider.cs index 57110128da..48ca848707 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/WindowsServicesCommandsProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsServices/WindowsServicesCommandsProvider.cs @@ -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() diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Commands/CopySettingCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Commands/CopySettingCommand.cs index 7f5fa1789e..d992a5fa6b 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Commands/CopySettingCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Commands/CopySettingCommand.cs @@ -10,7 +10,6 @@ using System.Resources; using System.Text; using System.Threading.Tasks; using Microsoft.CmdPal.Ext.WindowsSettings.Classes; -using Microsoft.CmdPal.Ext.WindowsSettings.Helpers; using Microsoft.CmdPal.Ext.WindowsSettings.Properties; using Microsoft.CommandPalette.Extensions; using Microsoft.CommandPalette.Extensions.Toolkit; @@ -27,7 +26,7 @@ internal sealed partial class CopySettingCommand : InvokableCommand internal CopySettingCommand(WindowsSetting entry) { Name = Resources.CopyCommand; - Icon = new IconInfo("\xE8C8"); // Copy icon + Icon = Icons.CopyIcon; _entry = entry; } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Commands/OpenSettingsCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Commands/OpenSettingsCommand.cs index 9460cd9240..fd94bc63da 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Commands/OpenSettingsCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Commands/OpenSettingsCommand.cs @@ -10,7 +10,6 @@ using System.Resources; using System.Text; using System.Threading.Tasks; using Microsoft.CmdPal.Ext.WindowsSettings.Classes; -using Microsoft.CmdPal.Ext.WindowsSettings.Helpers; using Microsoft.CmdPal.Ext.WindowsSettings.Properties; using Microsoft.CommandPalette.Extensions; using Microsoft.CommandPalette.Extensions.Toolkit; @@ -27,7 +26,7 @@ internal sealed partial class OpenSettingsCommand : InvokableCommand internal OpenSettingsCommand(WindowsSetting entry) { Name = Resources.OpenSettings; - Icon = new IconInfo("\xE8C8"); + Icon = Icons.CopyIcon; _entry = entry; } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Helpers/ResultHelper.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Helpers/ResultHelper.cs index ab457a7956..fb4828688c 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Helpers/ResultHelper.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Helpers/ResultHelper.cs @@ -8,7 +8,6 @@ using System.Diagnostics; using System.Globalization; using System.Linq; using System.Text; - using Microsoft.CmdPal.Ext.WindowsSettings.Commands; using Microsoft.CmdPal.Ext.WindowsSettings.Helpers; using Microsoft.CmdPal.Ext.WindowsSettings.Properties; @@ -30,7 +29,7 @@ internal static class ResultHelper { var result = new ListItem(new OpenSettingsCommand(entry)) { - Icon = IconHelpers.FromRelativePath("Assets\\WindowsSettings.svg"), + Icon = Icons.WindowsSettingsIcon, Subtitle = entry.JoinedFullSettingsPath, Title = entry.Name, MoreCommands = ContextMenuHelper.GetContextMenu(entry).ToArray(), diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Icons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Icons.cs new file mode 100644 index 0000000000..9534523f60 --- /dev/null +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Icons.cs @@ -0,0 +1,14 @@ +// 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.WindowsSettings; + +internal sealed class Icons +{ + internal static IconInfo WindowsSettingsIcon { get; } = IconHelpers.FromRelativePath("Assets\\WindowsSettings.svg"); + + internal static IconInfo CopyIcon { get; } = new IconInfo("\xE8C8"); // Copy icon +} diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Pages/FallbackWindowsSettingsItem.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Pages/FallbackWindowsSettingsItem.cs index a7a7291e91..a63a2965bd 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Pages/FallbackWindowsSettingsItem.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Pages/FallbackWindowsSettingsItem.cs @@ -24,7 +24,7 @@ internal sealed partial class FallbackWindowsSettingsItem : FallbackCommandItem public FallbackWindowsSettingsItem(Classes.WindowsSettings windowsSettings) : base(new NoOpCommand(), Resources.settings_title) { - Icon = IconHelpers.FromRelativePath("Assets\\WindowsSettings.svg"); + Icon = Icons.WindowsSettingsIcon; _windowsSettings = windowsSettings; } @@ -59,10 +59,10 @@ internal sealed partial class FallbackWindowsSettingsItem : FallbackCommandItem Title = setting.Name; Subtitle = setting.JoinedFullSettingsPath; - Icon = IconHelpers.FromRelativePath("Assets\\WindowsSettings.svg"); + Icon = Icons.WindowsSettingsIcon; Command = new OpenSettingsCommand(setting) { - Icon = IconHelpers.FromRelativePath("Assets\\WindowsSettings.svg"), + Icon = Icons.WindowsSettingsIcon, Name = setting.Name, }; @@ -80,7 +80,7 @@ internal sealed partial class FallbackWindowsSettingsItem : FallbackCommandItem // us to the Windows Settings search page, prepopulated with this search. var settingsPage = new WindowsSettingsListPage(_windowsSettings, query); Title = string.Format(CultureInfo.CurrentCulture, _title, query); - Icon = IconHelpers.FromRelativePath("Assets\\WindowsSettings.svg"); + Icon = Icons.WindowsSettingsIcon; Subtitle = _subtitle; Command = settingsPage; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Pages/WindowsSettingsListPage.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Pages/WindowsSettingsListPage.cs index 3ac04005e2..3c27d28537 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Pages/WindowsSettingsListPage.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Pages/WindowsSettingsListPage.cs @@ -19,7 +19,7 @@ internal sealed partial class WindowsSettingsListPage : DynamicListPage public WindowsSettingsListPage(Classes.WindowsSettings windowsSettings) { - Icon = IconHelpers.FromRelativePath("Assets\\WindowsSettings.svg"); + Icon = Icons.WindowsSettingsIcon; Name = Resources.settings_title; Id = "com.microsoft.cmdpal.windowsSettings"; _windowsSettings = windowsSettings; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettingsCommandsProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettingsCommandsProvider.cs index 25559b394e..600e621c99 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettingsCommandsProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettingsCommandsProvider.cs @@ -24,7 +24,7 @@ public partial class WindowsSettingsCommandsProvider : CommandProvider { Id = "Windows.Settings"; DisplayName = Resources.WindowsSettingsProvider_DisplayName; - Icon = IconHelpers.FromRelativePath("Assets\\WindowsSettings.svg"); + Icon = Icons.WindowsSettingsIcon; _windowsSettings = JsonSettingsListHelper.ReadAllPossibleSettings(); _searchSettingsListItem = new CommandItem(new WindowsSettingsListPage(_windowsSettings)) diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/Commands/LaunchProfileAsAdminCommand.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/Commands/LaunchProfileAsAdminCommand.cs index 1d1fcac873..f215ba5e94 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/Commands/LaunchProfileAsAdminCommand.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/Commands/LaunchProfileAsAdminCommand.cs @@ -29,7 +29,7 @@ internal sealed partial class LaunchProfileAsAdminCommand : InvokableCommand this._openQuake = openQuake; this.Name = Resources.launch_profile_as_admin; - this.Icon = new IconInfo("\xE7EF"); // Admin icon + this.Icon = Icons.AdminIcon; } private void LaunchElevated(string id, string profile) diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/Icons.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/Icons.cs new file mode 100644 index 0000000000..57abd2c01d --- /dev/null +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/Icons.cs @@ -0,0 +1,14 @@ +// 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.WindowsTerminal; + +internal sealed class Icons +{ + internal static IconInfo TerminalIcon { get; } = IconHelpers.FromRelativePath("Assets\\WindowsTerminal.svg"); + + internal static IconInfo AdminIcon { get; } = new IconInfo("\xE7EF"); // Admin icon +} diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/Pages/ProfilesListPage.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/Pages/ProfilesListPage.cs index 752aca5574..b426e96914 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/Pages/ProfilesListPage.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/Pages/ProfilesListPage.cs @@ -24,7 +24,7 @@ internal sealed partial class ProfilesListPage : ListPage public ProfilesListPage(SettingsManager terminalSettings) { - Icon = WindowsTerminalCommandsProvider.TerminalIcon; + Icon = Icons.TerminalIcon; Name = Resources.profiles_list_page_name; _terminalSettings = terminalSettings; } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/TerminalTopLevelCommandItem.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/TerminalTopLevelCommandItem.cs index 8f0f81c7c1..0eebd98adf 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/TerminalTopLevelCommandItem.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/TerminalTopLevelCommandItem.cs @@ -14,7 +14,7 @@ public partial class TerminalTopLevelCommandItem : CommandItem public TerminalTopLevelCommandItem(SettingsManager settingsManager) : base(new ProfilesListPage(settingsManager)) { - Icon = WindowsTerminalCommandsProvider.TerminalIcon; + Icon = Icons.TerminalIcon; Title = Resources.list_item_title; } } diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/WindowsTerminalCommandsProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/WindowsTerminalCommandsProvider.cs index cc311541ef..bd825cbddb 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/WindowsTerminalCommandsProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/WindowsTerminalCommandsProvider.cs @@ -14,13 +14,11 @@ public partial class WindowsTerminalCommandsProvider : CommandProvider private readonly TerminalTopLevelCommandItem _terminalCommand; private readonly SettingsManager _settingsManager = new(); - public static IconInfo TerminalIcon { get; } = IconHelpers.FromRelativePath("Assets\\WindowsTerminal.svg"); - public WindowsTerminalCommandsProvider() { Id = "WindowsTerminalProfiles"; DisplayName = Resources.extension_name; - Icon = TerminalIcon; + Icon = Icons.TerminalIcon; Settings = _settingsManager.Settings; _terminalCommand = new TerminalTopLevelCommandItem(_settingsManager)