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:
Michael Jolley
2025-07-15 14:33:25 -05:00
committed by GitHub
parent cc16b61eb7
commit b552f2ac1e
93 changed files with 371 additions and 245 deletions

View File

@@ -25,7 +25,7 @@ public partial class AllAppsCommandProvider : CommandProvider
{ {
Id = WellKnownId; Id = WellKnownId;
DisplayName = Resources.installed_apps; DisplayName = Resources.installed_apps;
Icon = IconHelpers.FromRelativePath("Assets\\AllApps.svg"); Icon = Icons.AllAppsIcon;
Settings = AllAppsSettings.Instance.Settings; Settings = AllAppsSettings.Instance.Settings;
_listItem = new(Page) _listItem = new(Page)

View File

@@ -12,7 +12,6 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using ManagedCommon; using ManagedCommon;
using Microsoft.CmdPal.Ext.Apps.Commands; using Microsoft.CmdPal.Ext.Apps.Commands;
using Microsoft.CmdPal.Ext.Apps.Helpers;
using Microsoft.CmdPal.Ext.Apps.Programs; using Microsoft.CmdPal.Ext.Apps.Programs;
using Microsoft.CmdPal.Ext.Apps.Properties; using Microsoft.CmdPal.Ext.Apps.Properties;
using Microsoft.CmdPal.Ext.Apps.State; using Microsoft.CmdPal.Ext.Apps.State;

View File

@@ -6,7 +6,6 @@ using System;
using System.Globalization; using System.Globalization;
using System.Text; using System.Text;
using ManagedCommon; using ManagedCommon;
using Microsoft.CmdPal.Ext.Apps.Helpers;
using Microsoft.CmdPal.Ext.Apps.Properties; using Microsoft.CmdPal.Ext.Apps.Properties;
using Microsoft.CommandPalette.Extensions.Toolkit; using Microsoft.CommandPalette.Extensions.Toolkit;

View File

@@ -6,7 +6,6 @@ using System;
using System.Diagnostics; using System.Diagnostics;
using System.Threading.Tasks; using System.Threading.Tasks;
using ManagedCommon; using ManagedCommon;
using Microsoft.CmdPal.Ext.Apps.Helpers;
using Microsoft.CmdPal.Ext.Apps.Properties; using Microsoft.CmdPal.Ext.Apps.Properties;
using Microsoft.CommandPalette.Extensions.Toolkit; using Microsoft.CommandPalette.Extensions.Toolkit;
@@ -19,7 +18,7 @@ internal sealed partial class OpenInConsoleCommand : InvokableCommand
public OpenInConsoleCommand(string target) public OpenInConsoleCommand(string target)
{ {
Name = Resources.open_path_in_console; Name = Resources.open_path_in_console;
Icon = Icons.OpenConsoleIcon; Icon = Icons.OpenPathIcon;
_target = target; _target = target;
} }

View File

@@ -4,7 +4,6 @@
using System.Diagnostics; using System.Diagnostics;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.CmdPal.Ext.Apps.Helpers;
using Microsoft.CmdPal.Ext.Apps.Properties; using Microsoft.CmdPal.Ext.Apps.Properties;
using Microsoft.CommandPalette.Extensions.Toolkit; using Microsoft.CommandPalette.Extensions.Toolkit;

View File

@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using Microsoft.CmdPal.Ext.Apps.Helpers;
using Microsoft.CmdPal.Ext.Apps.Properties; using Microsoft.CmdPal.Ext.Apps.Properties;
using Microsoft.CmdPal.Ext.Apps.State; using Microsoft.CmdPal.Ext.Apps.State;
using Microsoft.CommandPalette.Extensions.Toolkit; using Microsoft.CommandPalette.Extensions.Toolkit;

View File

@@ -5,7 +5,6 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.CmdPal.Ext.Apps.Helpers;
using Microsoft.CmdPal.Ext.Apps.Properties; using Microsoft.CmdPal.Ext.Apps.Properties;
using Microsoft.CmdPal.Ext.Apps.Utils; using Microsoft.CmdPal.Ext.Apps.Utils;
using Microsoft.CommandPalette.Extensions.Toolkit; using Microsoft.CommandPalette.Extensions.Toolkit;
@@ -21,7 +20,7 @@ internal sealed partial class RunAsAdminCommand : InvokableCommand
public RunAsAdminCommand(string target, string parentDir, bool packaged) public RunAsAdminCommand(string target, string parentDir, bool packaged)
{ {
Name = Resources.run_as_administrator; Name = Resources.run_as_administrator;
Icon = Icons.RunAsIcon; Icon = Icons.RunAsAdminIcon;
_target = target; _target = target;
_parentDir = parentDir; _parentDir = parentDir;

View File

@@ -5,7 +5,6 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.CmdPal.Ext.Apps.Helpers;
using Microsoft.CmdPal.Ext.Apps.Properties; using Microsoft.CmdPal.Ext.Apps.Properties;
using Microsoft.CmdPal.Ext.Apps.Utils; using Microsoft.CmdPal.Ext.Apps.Utils;
using Microsoft.CommandPalette.Extensions.Toolkit; using Microsoft.CommandPalette.Extensions.Toolkit;

View File

@@ -2,7 +2,6 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // 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.Properties;
using Microsoft.CmdPal.Ext.Apps.State; using Microsoft.CmdPal.Ext.Apps.State;
using Microsoft.CommandPalette.Extensions.Toolkit; using Microsoft.CommandPalette.Extensions.Toolkit;

View File

@@ -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");
}

View File

@@ -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
}

View File

@@ -106,7 +106,6 @@ public class UWPApplication : IProgram
new OpenPathCommand(Location) new OpenPathCommand(Location)
{ {
Name = Resources.open_containing_folder, Name = Resources.open_containing_folder,
Icon = new("\ue838"),
}) })
{ {
RequestedShortcut = KeyChordHelpers.FromModifiers(ctrl: true, shift: true, vkey: VirtualKey.E), RequestedShortcut = KeyChordHelpers.FromModifiers(ctrl: true, shift: true, vkey: VirtualKey.E),

View File

@@ -25,7 +25,7 @@ internal sealed partial class AddBookmarkPage : ContentPage
{ {
var name = bookmark?.Name ?? string.Empty; var name = bookmark?.Name ?? string.Empty;
var url = bookmark?.Bookmark ?? 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); var isAdd = string.IsNullOrEmpty(name) && string.IsNullOrEmpty(url);
Title = isAdd ? Resources.bookmarks_add_title : Resources.bookmarks_edit_name; Title = isAdd ? Resources.bookmarks_add_title : Resources.bookmarks_edit_name;
Name = isAdd ? Resources.bookmarks_add_name : Resources.bookmarks_edit_name; Name = isAdd ? Resources.bookmarks_add_name : Resources.bookmarks_edit_name;

View File

@@ -23,15 +23,11 @@ public partial class BookmarksCommandProvider : CommandProvider
private Bookmarks? _bookmarks; 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() public BookmarksCommandProvider()
{ {
Id = "Bookmarks"; Id = "Bookmarks";
DisplayName = Resources.bookmarks_display_name; DisplayName = Resources.bookmarks_display_name;
Icon = new IconInfo("\uE718"); // Pin Icon = Icons.PinIcon;
_addNewCommand.AddedCommand += AddNewCommand_AddedCommand; _addNewCommand.AddedCommand += AddNewCommand_AddedCommand;
} }
@@ -132,7 +128,7 @@ public partial class BookmarksCommandProvider : CommandProvider
listItem.Subtitle = urlCommand.Url; listItem.Subtitle = urlCommand.Url;
} }
var edit = new AddBookmarkPage(bookmark) { Icon = EditIcon }; var edit = new AddBookmarkPage(bookmark) { Icon = Icons.EditIcon };
edit.AddedCommand += Edit_AddedCommand; edit.AddedCommand += Edit_AddedCommand;
contextMenu.Add(new CommandContextItem(edit)); contextMenu.Add(new CommandContextItem(edit));
@@ -153,7 +149,7 @@ public partial class BookmarksCommandProvider : CommandProvider
result: CommandResult.KeepOpen()) result: CommandResult.KeepOpen())
{ {
IsCritical = true, IsCritical = true,
Icon = DeleteIcon, Icon = Icons.DeleteIcon,
}; };
contextMenu.Add(delete); contextMenu.Add(delete);

View File

@@ -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
}

View File

@@ -25,7 +25,7 @@ public partial class CalculatorCommandProvider : CommandProvider
{ {
Id = "Calculator"; Id = "Calculator";
DisplayName = Resources.calculator_display_name; DisplayName = Resources.calculator_display_name;
Icon = CalculatorIcons.ProviderIcon; Icon = Icons.CalculatorIcon;
Settings = settings.Settings; Settings = settings.Settings;
} }

View File

@@ -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");
}

View File

@@ -47,7 +47,7 @@ internal static class ErrorHandler
{ {
Title = Properties.Resources.calculator_calculation_failed_title, Title = Properties.Resources.calculator_calculation_failed_title,
Subtitle = errorMessage, Subtitle = errorMessage,
Icon = CalculatorIcons.ErrorIcon, Icon = Icons.ErrorIcon,
}; };
} }
} }

View File

@@ -33,7 +33,7 @@ public static class ResultHelper
return new ListItem(saveCommand) return new ListItem(saveCommand)
{ {
// Using CurrentCulture since this is user facing // Using CurrentCulture since this is user facing
Icon = CalculatorIcons.ResultIcon, Icon = Icons.ResultIcon,
Title = result, Title = result,
Subtitle = query, Subtitle = query,
TextToSuggest = result, TextToSuggest = result,

View File

@@ -18,7 +18,7 @@ public sealed partial class SaveCommand : InvokableCommand
public SaveCommand(string result) public SaveCommand(string result)
{ {
Name = Resources.calculator_save_command_name; Name = Resources.calculator_save_command_name;
Icon = CalculatorIcons.SaveIcon; Icon = Icons.SaveIcon;
_result = result; _result = result;
} }

View File

@@ -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
}

View File

@@ -35,7 +35,7 @@ public sealed partial class CalculatorListPage : DynamicListPage
public CalculatorListPage(SettingsManager settings) public CalculatorListPage(SettingsManager settings)
{ {
_settingsManager = settings; _settingsManager = settings;
Icon = CalculatorIcons.ProviderIcon; Icon = Icons.CalculatorIcon;
Name = Resources.calculator_title; Name = Resources.calculator_title;
PlaceholderText = Resources.calculator_placeholder_text; PlaceholderText = Resources.calculator_placeholder_text;
Id = "com.microsoft.cmdpal.calculator"; Id = "com.microsoft.cmdpal.calculator";
@@ -43,11 +43,11 @@ public sealed partial class CalculatorListPage : DynamicListPage
_emptyItem = new ListItem(new NoOpCommand()) _emptyItem = new ListItem(new NoOpCommand())
{ {
Title = Resources.calculator_placeholder_text, Title = Resources.calculator_placeholder_text,
Icon = CalculatorIcons.ResultIcon, Icon = Icons.ResultIcon,
}; };
EmptyContent = new CommandItem(new NoOpCommand()) EmptyContent = new CommandItem(new NoOpCommand())
{ {
Icon = CalculatorIcons.ProviderIcon, Icon = Icons.CalculatorIcon,
Title = Resources.calculator_placeholder_text, Title = Resources.calculator_placeholder_text,
}; };

View File

@@ -20,7 +20,7 @@ public sealed partial class FallbackCalculatorItem : FallbackCommandItem
_copyCommand.Name = string.Empty; _copyCommand.Name = string.Empty;
Title = string.Empty; Title = string.Empty;
Subtitle = Resources.calculator_placeholder_text; Subtitle = Resources.calculator_placeholder_text;
Icon = CalculatorIcons.ProviderIcon; Icon = Icons.CalculatorIcon;
_settings = settings; _settings = settings;
} }

View File

@@ -18,11 +18,11 @@ public partial class ClipboardHistoryCommandsProvider : CommandProvider
{ {
Title = Properties.Resources.list_item_title, Title = Properties.Resources.list_item_title,
Subtitle = Properties.Resources.list_item_subtitle, Subtitle = Properties.Resources.list_item_subtitle,
Icon = Icons.ClipboardList, Icon = Icons.ClipboardListIcon,
}; };
DisplayName = Properties.Resources.provider_display_name; DisplayName = Properties.Resources.provider_display_name;
Icon = Icons.ClipboardList; Icon = Icons.ClipboardListIcon;
Id = "Windows.ClipboardHistory"; Id = "Windows.ClipboardHistory";
} }

View File

@@ -19,11 +19,11 @@ internal sealed partial class CopyCommand : InvokableCommand
Name = Properties.Resources.copy_command_name; Name = Properties.Resources.copy_command_name;
if (clipboardFormat == ClipboardFormat.Text) if (clipboardFormat == ClipboardFormat.Text)
{ {
Icon = Icons.Copy; Icon = Icons.CopyIcon;
} }
else else
{ {
Icon = Icons.Picture; Icon = Icons.PictureIcon;
} }
} }

View File

@@ -20,7 +20,7 @@ internal sealed partial class PasteCommand : InvokableCommand
_clipboardItem = clipboardItem; _clipboardItem = clipboardItem;
_clipboardFormat = clipboardFormat; _clipboardFormat = clipboardFormat;
Name = Properties.Resources.paste_command_name; Name = Properties.Resources.paste_command_name;
Icon = Icons.Paste; Icon = Icons.PasteIcon;
} }
private void HideWindow() private void HideWindow()

View File

@@ -8,11 +8,11 @@ namespace Microsoft.CmdPal.Ext.ClipboardHistory;
internal sealed class Icons 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");
} }

View File

@@ -24,7 +24,7 @@ internal sealed partial class ClipboardHistoryListPage : ListPage
{ {
clipboardHistory = []; clipboardHistory = [];
_defaultIconPath = string.Empty; _defaultIconPath = string.Empty;
Icon = Icons.ClipboardList; Icon = Icons.ClipboardListIcon;
Name = Properties.Resources.clipboard_history_page_name; Name = Properties.Resources.clipboard_history_page_name;
Id = "com.microsoft.cmdpal.clipboardHistory"; Id = "com.microsoft.cmdpal.clipboardHistory";
ShowDetails = true; ShowDetails = true;

View File

@@ -19,7 +19,7 @@ internal sealed partial class OpenFileCommand : InvokableCommand
{ {
this._item = item; this._item = item;
this.Name = Resources.Indexer_Command_OpenFile; this.Name = Resources.Indexer_Command_OpenFile;
this.Icon = Icons.OpenFile; this.Icon = Icons.OpenFileIcon;
} }
public override CommandResult Invoke() public override CommandResult Invoke()

View File

@@ -28,7 +28,7 @@ internal sealed partial class FallbackOpenFileItem : FallbackCommandItem, System
{ {
Title = string.Empty; Title = string.Empty;
Subtitle = string.Empty; Subtitle = string.Empty;
Icon = Icons.FileExplorer; Icon = Icons.FileExplorerIcon;
} }
public override void UpdateQuery(string query) 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. // us to the file search page, prepopulated with this search.
var indexerPage = new IndexerPage(query, _searchEngine, _queryCookie, results); var indexerPage = new IndexerPage(query, _searchEngine, _queryCookie, results);
Title = string.Format(CultureInfo.CurrentCulture, fallbackItemSearchPageTitleCompositeFormat, query); Title = string.Format(CultureInfo.CurrentCulture, fallbackItemSearchPageTitleCompositeFormat, query);
Icon = Icons.FileExplorer; Icon = Icons.FileExplorerIcon;
Subtitle = Resources.Indexer_Subtitle; Subtitle = Resources.Indexer_Subtitle;
Command = indexerPage; Command = indexerPage;

View File

@@ -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
}

View File

@@ -18,7 +18,7 @@ public partial class IndexerCommandsProvider : CommandProvider
{ {
Id = "Files"; Id = "Files";
DisplayName = Resources.IndexerCommandsProvider_DisplayName; DisplayName = Resources.IndexerCommandsProvider_DisplayName;
Icon = Icons.FileExplorer; Icon = Icons.FileExplorerIcon;
if (IndexerListItem.IsActionsFeatureEnabled && ApiInformation.IsApiContractPresent("Windows.AI.Actions.ActionsContract", 4)) if (IndexerListItem.IsActionsFeatureEnabled && ApiInformation.IsApiContractPresent("Windows.AI.Actions.ActionsContract", 4))
{ {

View File

@@ -27,7 +27,7 @@ internal sealed partial class ActionsListContextItem : CommandContextItem, IDisp
: base(new NoOpCommand()) : base(new NoOpCommand())
{ {
Title = Resources.Indexer_Command_Actions; Title = Resources.Indexer_Command_Actions;
Icon = Icons.Actions; Icon = Icons.ActionsIcon;
RequestedShortcut = KeyChordHelpers.FromModifiers(alt: true, vkey: VirtualKey.A); RequestedShortcut = KeyChordHelpers.FromModifiers(alt: true, vkey: VirtualKey.A);
this.fullPath = fullPath; this.fullPath = fullPath;
UpdateMoreCommands(); UpdateMoreCommands();

View File

@@ -28,7 +28,7 @@ public sealed partial class DirectoryExplorePage : DynamicListPage
public DirectoryExplorePage(string path) public DirectoryExplorePage(string path)
{ {
_path = path; _path = path;
Icon = Icons.FileExplorer; Icon = Icons.FileExplorerIcon;
Name = Resources.Indexer_Command_Browse; Name = Resources.Indexer_Command_Browse;
Title = path; Title = path;
} }

View File

@@ -24,7 +24,7 @@ public sealed partial class DirectoryPage : ListPage
public DirectoryPage(string path) public DirectoryPage(string path)
{ {
_path = path; _path = path;
Icon = Icons.FileExplorer; Icon = Icons.FileExplorerIcon;
Name = Resources.Indexer_Command_Browse; Name = Resources.Indexer_Command_Browse;
Title = path; Title = path;
} }
@@ -52,7 +52,7 @@ public sealed partial class DirectoryPage : ListPage
EmptyContent = new CommandItem( EmptyContent = new CommandItem(
title: Resources.Indexer_File_Is_File_Not_Folder, subtitle: $"{_path}") title: Resources.Indexer_File_Is_File_Not_Folder, subtitle: $"{_path}")
{ {
Icon = Icons.Document, Icon = Icons.DocumentIcon,
}; };
return []; return [];
} }
@@ -66,7 +66,7 @@ public sealed partial class DirectoryPage : ListPage
EmptyContent = new CommandItem( EmptyContent = new CommandItem(
title: Resources.Indexer_Folder_Is_Empty, subtitle: $"{_path}") title: Resources.Indexer_Folder_Is_Empty, subtitle: $"{_path}")
{ {
Icon = Icons.FolderOpen, Icon = Icons.FolderOpenIcon,
Command = listItemForUs.Command, Command = listItemForUs.Command,
MoreCommands = listItemForUs.MoreCommands, MoreCommands = listItemForUs.MoreCommands,
}; };

View File

@@ -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
}

View File

@@ -24,7 +24,7 @@ internal sealed partial class IndexerPage : DynamicListPage, IDisposable
public IndexerPage() public IndexerPage()
{ {
Id = "com.microsoft.indexer.fileSearch"; Id = "com.microsoft.indexer.fileSearch";
Icon = Icons.FileExplorer; Icon = Icons.FileExplorerIcon;
Name = Resources.Indexer_Title; Name = Resources.Indexer_Title;
PlaceholderText = Resources.Indexer_PlaceholderText; PlaceholderText = Resources.Indexer_PlaceholderText;
_searchEngine = new(); _searchEngine = new();
@@ -33,7 +33,7 @@ internal sealed partial class IndexerPage : DynamicListPage, IDisposable
public IndexerPage(string query, SearchEngine searchEngine, uint queryCookie, IList<IListItem> firstPageData) public IndexerPage(string query, SearchEngine searchEngine, uint queryCookie, IList<IListItem> firstPageData)
{ {
Icon = Icons.FileExplorer; Icon = Icons.FileExplorerIcon;
Name = Resources.Indexer_Title; Name = Resources.Indexer_Title;
_searchEngine = searchEngine; _searchEngine = searchEngine;
_queryCookie = queryCookie; _queryCookie = queryCookie;

View File

@@ -21,19 +21,19 @@ internal sealed partial class CopyRegistryInfoCommand : InvokableCommand
if (typeToCopy == CopyType.Key) if (typeToCopy == CopyType.Key)
{ {
Name = Resources.CopyKeyNamePath; Name = Resources.CopyKeyNamePath;
Icon = new IconInfo("\xE8C8"); // Copy Icon Icon = Icons.CopyIcon;
_stringToCopy = entry.GetRegistryKey(); _stringToCopy = entry.GetRegistryKey();
} }
else if (typeToCopy == CopyType.ValueData) else if (typeToCopy == CopyType.ValueData)
{ {
Name = Resources.CopyValueData; Name = Resources.CopyValueData;
Icon = new IconInfo("\xF413"); // CopyTo Icon Icon = Icons.CopyToIcon;
_stringToCopy = entry.GetValueData(); _stringToCopy = entry.GetValueData();
} }
else if (typeToCopy == CopyType.ValueName) else if (typeToCopy == CopyType.ValueName)
{ {
Name = Resources.CopyValueName; Name = Resources.CopyValueName;
Icon = new IconInfo("\xE8C8"); // Copy Icon Icon = Icons.CopyIcon;
_stringToCopy = entry.GetValueNameWithKey(); _stringToCopy = entry.GetValueNameWithKey();
} }

View File

@@ -27,7 +27,7 @@ internal sealed partial class OpenKeyInEditorCommand : InvokableCommand
internal OpenKeyInEditorCommand(RegistryEntry entry) internal OpenKeyInEditorCommand(RegistryEntry entry)
{ {
Name = Resources.OpenKeyInRegistryEditor; Name = Resources.OpenKeyInRegistryEditor;
Icon = new IconInfo("\xE8A7"); // OpenInNewWindow icon Icon = Icons.OpenInNewWindowIcon;
_entry = entry; _entry = entry;
} }

View File

@@ -101,7 +101,7 @@ internal static class ResultHelper
resultList.Add(new ListItem(new OpenKeyInEditorCommand(registryEntry)) resultList.Add(new ListItem(new OpenKeyInEditorCommand(registryEntry))
{ {
Icon = RegistryListPage.RegistryIcon, Icon = Icons.RegistryIcon,
Subtitle = GetTruncatedText(valueException.Message, MaxTextLength.MaximumSubTitleLengthWithThreeSymbols, TruncateSide.OnlyFromRight), Subtitle = GetTruncatedText(valueException.Message, MaxTextLength.MaximumSubTitleLengthWithThreeSymbols, TruncateSide.OnlyFromRight),
Title = GetTruncatedText(key.Name, MaxTextLength.MaximumTitleLengthWithThreeSymbols), Title = GetTruncatedText(key.Name, MaxTextLength.MaximumTitleLengthWithThreeSymbols),
MoreCommands = ContextMenuHelper.GetContextMenu(registryEntry).ToArray(), MoreCommands = ContextMenuHelper.GetContextMenu(registryEntry).ToArray(),
@@ -130,7 +130,7 @@ internal static class ResultHelper
resultList.Add(new ListItem(new OpenKeyInEditorCommand(registryEntry)) resultList.Add(new ListItem(new OpenKeyInEditorCommand(registryEntry))
{ {
Icon = RegistryListPage.RegistryIcon, Icon = Icons.RegistryIcon,
Subtitle = GetTruncatedText(GetSubTileForRegistryValue(key, valueEntry), MaxTextLength.MaximumSubTitleLengthWithThreeSymbols, TruncateSide.OnlyFromRight), Subtitle = GetTruncatedText(GetSubTileForRegistryValue(key, valueEntry), MaxTextLength.MaximumSubTitleLengthWithThreeSymbols, TruncateSide.OnlyFromRight),
Title = GetTruncatedText(valueName, MaxTextLength.MaximumTitleLengthWithThreeSymbols), Title = GetTruncatedText(valueName, MaxTextLength.MaximumTitleLengthWithThreeSymbols),
MoreCommands = ContextMenuHelper.GetContextMenu(registryEntry).ToArray(), MoreCommands = ContextMenuHelper.GetContextMenu(registryEntry).ToArray(),
@@ -145,7 +145,7 @@ internal static class ResultHelper
resultList.Add(new ListItem(new OpenKeyInEditorCommand(registryEntry)) resultList.Add(new ListItem(new OpenKeyInEditorCommand(registryEntry))
{ {
Icon = RegistryListPage.RegistryIcon, Icon = Icons.RegistryIcon,
Subtitle = GetTruncatedText(exception.Message, MaxTextLength.MaximumSubTitleLengthWithThreeSymbols, TruncateSide.OnlyFromRight), Subtitle = GetTruncatedText(exception.Message, MaxTextLength.MaximumSubTitleLengthWithThreeSymbols, TruncateSide.OnlyFromRight),
Title = GetTruncatedText(key.Name, MaxTextLength.MaximumTitleLengthWithThreeSymbols), Title = GetTruncatedText(key.Name, MaxTextLength.MaximumTitleLengthWithThreeSymbols),
}); });

View File

@@ -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
}

View File

@@ -21,12 +21,12 @@ internal sealed partial class RegistryListPage : DynamicListPage
public RegistryListPage() public RegistryListPage()
{ {
Icon = IconHelpers.FromRelativePath("Assets\\Registry.svg"); Icon = Icons.RegistryIcon;
Name = Title = Resources.Registry_Page_Title; Name = Title = Resources.Registry_Page_Title;
Id = "com.microsoft.cmdpal.registry"; Id = "com.microsoft.cmdpal.registry";
_emptyMessage = new CommandItem() _emptyMessage = new CommandItem()
{ {
Icon = IconHelpers.FromRelativePath("Assets\\Registry.svg"), Icon = Icons.RegistryIcon,
Title = Resources.Registry_Key_Not_Found, Title = Resources.Registry_Key_Not_Found,
Subtitle = SearchText, Subtitle = SearchText,
}; };

View File

@@ -14,7 +14,7 @@ public partial class RegistryCommandsProvider : CommandProvider
{ {
Id = "Windows.Registry"; Id = "Windows.Registry";
DisplayName = Resources.RegistryProvider_DisplayName; DisplayName = Resources.RegistryProvider_DisplayName;
Icon = IconHelpers.FromRelativePath("Assets\\Registry.svg"); Icon = Icons.RegistryIcon;
} }
public override ICommandItem[] TopLevelCommands() public override ICommandItem[] TopLevelCommands()

View File

@@ -26,17 +26,17 @@ internal sealed partial class ExecuteItem : InvokableCommand
if (type == RunAsType.Administrator) if (type == RunAsType.Administrator)
{ {
Name = Properties.Resources.cmd_run_as_administrator; Name = Properties.Resources.cmd_run_as_administrator;
Icon = new IconInfo("\xE7EF"); // Admin Icon Icon = Icons.AdminIcon;
} }
else if (type == RunAsType.OtherUser) else if (type == RunAsType.OtherUser)
{ {
Name = Properties.Resources.cmd_run_as_user; Name = Properties.Resources.cmd_run_as_user;
Icon = new IconInfo("\xE7EE"); // User Icon Icon = Icons.UserIcon;
} }
else else
{ {
Name = Properties.Resources.generic_run_command; Name = Properties.Resources.generic_run_command;
Icon = new IconInfo("\uE751"); // Return Key Icon Icon = Icons.ReturnIcon;
} }
Cmd = cmd; Cmd = cmd;

View File

@@ -24,7 +24,7 @@ internal sealed partial class FallbackExecuteItem : FallbackCommandItem
Title = string.Empty; Title = string.Empty;
_executeItem.Name = string.Empty; _executeItem.Name = string.Empty;
Subtitle = Properties.Resources.generic_run_command; 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) public override void UpdateQuery(string query)

View File

@@ -55,7 +55,7 @@ public class ShellListPageHelpers
// Using CurrentCulture since this is user facing // Using CurrentCulture since this is user facing
Subtitle = Properties.Resources.cmd_plugin_name + ": " + string.Format(CultureInfo.CurrentCulture, CmdHasBeenExecutedTimes, m.Value), Subtitle = Properties.Resources.cmd_plugin_name + ": " + string.Format(CultureInfo.CurrentCulture, CmdHasBeenExecutedTimes, m.Value),
Icon = new IconInfo("\uE81C"), Icon = Icons.HistoryIcon,
}; };
return ret; return ret;
}).Where(o => o != null).Take(4); }).Where(o => o != null).Take(4);
@@ -108,7 +108,7 @@ public class ShellListPageHelpers
// Using CurrentCulture since this is user facing // Using CurrentCulture since this is user facing
Subtitle = Properties.Resources.cmd_plugin_name + ": " + string.Format(CultureInfo.CurrentCulture, CmdHasBeenExecutedTimes, m.Value), Subtitle = Properties.Resources.cmd_plugin_name + ": " + string.Format(CultureInfo.CurrentCulture, CmdHasBeenExecutedTimes, m.Value),
Icon = new IconInfo("\uE81C"), Icon = Icons.HistoryIcon,
}).Take(5); }).Take(5);
return history.ToList(); return history.ToList();

View File

@@ -8,5 +8,13 @@ namespace Microsoft.CmdPal.Ext.Shell;
internal sealed class Icons 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
} }

View File

@@ -15,7 +15,7 @@ internal sealed partial class ShellListPage : DynamicListPage
public ShellListPage(SettingsManager settingsManager) public ShellListPage(SettingsManager settingsManager)
{ {
Icon = Icons.RunV2; Icon = Icons.RunV2Icon;
Id = "com.microsoft.cmdpal.shell"; Id = "com.microsoft.cmdpal.shell";
Name = Resources.cmd_plugin_name; Name = Resources.cmd_plugin_name;
PlaceholderText = Resources.list_placeholder_text; PlaceholderText = Resources.list_placeholder_text;

View File

@@ -20,14 +20,14 @@ public partial class ShellCommandsProvider : CommandProvider
{ {
Id = "Run"; Id = "Run";
DisplayName = Resources.cmd_plugin_name; DisplayName = Resources.cmd_plugin_name;
Icon = Icons.RunV2; Icon = Icons.RunV2Icon;
Settings = _settingsManager.Settings; Settings = _settingsManager.Settings;
_fallbackItem = new FallbackExecuteItem(_settingsManager); _fallbackItem = new FallbackExecuteItem(_settingsManager);
_shellPageItem = new CommandItem(new ShellListPage(_settingsManager)) _shellPageItem = new CommandItem(new ShellListPage(_settingsManager))
{ {
Icon = Icons.RunV2, Icon = Icons.RunV2Icon,
Title = Resources.shell_command_name, Title = Resources.shell_command_name,
Subtitle = Resources.cmd_plugin_description, Subtitle = Resources.cmd_plugin_description,
MoreCommands = [ MoreCommands = [

View File

@@ -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");
}

View File

@@ -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");
}

View File

@@ -42,10 +42,10 @@ internal sealed class AvailableResult
{ {
return IconType switch return IconType switch
{ {
ResultIconType.Time => ResultHelper.TimeIcon, ResultIconType.Time => Icons.TimeIcon,
ResultIconType.Date => ResultHelper.CalendarIcon, ResultIconType.Date => Icons.CalendarIcon,
ResultIconType.DateTime => ResultHelper.TimeDateIcon, ResultIconType.DateTime => Icons.TimeDateIcon,
ResultIconType.Error => ResultHelper.ErrorIcon, ResultIconType.Error => Icons.ErrorIcon,
_ => null, _ => null,
}; };
} }

View File

@@ -104,7 +104,7 @@ internal static class AvailableResultsList
dtObject = dateTimeNowUtc; 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); var value = TimeAndDateHelper.ConvertToCustomFormat(dtObject, unixTimestamp, unixTimestampMilliseconds, weekOfYear, eraShort, Regex.Replace(formatSyntax, "^UTC:", string.Empty), firstWeekRule, firstDayOfTheWeek);
try try
{ {

View File

@@ -26,14 +26,6 @@ internal static class ResultHelper
: Resources.ResourceManager.GetString(stringId + "Now", CultureInfo.CurrentUICulture) ?? string.Empty; : 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> /// <summary>
/// Gets a result with an error message that input can't be parsed /// Gets a result with an error message that input can't be parsed
/// </summary> /// </summary>
@@ -42,7 +34,7 @@ internal static class ResultHelper
internal static ListItem CreateInvalidInputErrorResult() => new ListItem(new NoOpCommand()) internal static ListItem CreateInvalidInputErrorResult() => new ListItem(new NoOpCommand())
{ {
Title = Resources.Microsoft_plugin_timedate_InvalidInput_ErrorMessageTitle, Title = Resources.Microsoft_plugin_timedate_InvalidInput_ErrorMessageTitle,
Icon = ErrorIcon, Icon = Icons.ErrorIcon,
Details = new Details() Details = new Details()
{ {
Title = Resources.Microsoft_plugin_timedate_InvalidInput_DetailsHeader, Title = Resources.Microsoft_plugin_timedate_InvalidInput_DetailsHeader,

View File

@@ -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");
}

View File

@@ -23,7 +23,7 @@ internal sealed partial class TimeDateExtensionPage : DynamicListPage
public TimeDateExtensionPage(SettingsManager settingsManager) public TimeDateExtensionPage(SettingsManager settingsManager)
{ {
Icon = IconHelpers.FromRelativePath("Assets\\TimeDate.svg"); Icon = Icons.TimeDateExtIcon;
Title = Resources.Microsoft_plugin_timedate_main_page_title; Title = Resources.Microsoft_plugin_timedate_main_page_title;
Name = Resources.Microsoft_plugin_timedate_main_page_name; Name = Resources.Microsoft_plugin_timedate_main_page_name;
PlaceholderText = Resources.Microsoft_plugin_timedate_placeholder_text; PlaceholderText = Resources.Microsoft_plugin_timedate_placeholder_text;

View File

@@ -2,7 +2,6 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using Microsoft.CmdPal.Ext.WebSearch.Helpers;
using Microsoft.CommandPalette.Extensions.Toolkit; using Microsoft.CommandPalette.Extensions.Toolkit;
using BrowserInfo = Microsoft.CmdPal.Ext.WebSearch.Helpers.DefaultBrowserInfo; using BrowserInfo = Microsoft.CmdPal.Ext.WebSearch.Helpers.DefaultBrowserInfo;
@@ -11,17 +10,14 @@ namespace Microsoft.CmdPal.Ext.WebSearch.Commands;
internal sealed partial class OpenURLCommand : InvokableCommand internal sealed partial class OpenURLCommand : InvokableCommand
{ {
private readonly SettingsManager _settingsManager;
public string Url { get; internal set; } = string.Empty; public string Url { get; internal set; } = string.Empty;
internal OpenURLCommand(string url, SettingsManager settingsManager) internal OpenURLCommand(string url)
{ {
Url = url; Url = url;
BrowserInfo.UpdateIfTimePassed(); BrowserInfo.UpdateIfTimePassed();
Icon = IconHelpers.FromRelativePath("Assets\\WebSearch.png"); Icon = Icons.WebSearch;
Name = string.Empty; Name = string.Empty;
_settingsManager = settingsManager;
} }
public override CommandResult Invoke() public override CommandResult Invoke()

View File

@@ -21,7 +21,7 @@ internal sealed partial class SearchWebCommand : InvokableCommand
{ {
Arguments = arguments; Arguments = arguments;
BrowserInfo.UpdateIfTimePassed(); BrowserInfo.UpdateIfTimePassed();
Icon = IconHelpers.FromRelativePath("Assets\\WebSearch.png"); Icon = Icons.WebSearch;
Name = Properties.Resources.open_in_default_browser; Name = Properties.Resources.open_in_default_browser;
_settingsManager = settingsManager; _settingsManager = settingsManager;
} }

View File

@@ -23,7 +23,7 @@ internal sealed partial class FallbackExecuteSearchItem : FallbackCommandItem
Title = string.Empty; Title = string.Empty;
_executeItem.Name = string.Empty; _executeItem.Name = string.Empty;
Subtitle = string.Format(CultureInfo.CurrentCulture, PluginOpen, BrowserInfo.Name ?? BrowserInfo.MSEdgeName); 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) public override void UpdateQuery(string query)

View File

@@ -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); private static readonly CompositeFormat PluginOpenUrlInBrowser = System.Text.CompositeFormat.Parse(Properties.Resources.plugin_open_url_in_browser);
public FallbackOpenURLItem(SettingsManager settings) 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!; _executeItem = (OpenURLCommand)this.Command!;
Title = string.Empty; Title = string.Empty;
_executeItem.Name = string.Empty; _executeItem.Name = string.Empty;
Subtitle = string.Empty; Subtitle = string.Empty;
Icon = IconHelpers.FromRelativePath("Assets\\WebSearch.png"); Icon = Icons.WebSearch;
} }
public override void UpdateQuery(string query) public override void UpdateQuery(string query)

View File

@@ -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");
}

View File

@@ -20,7 +20,7 @@ public partial class WebSearchCommandsProvider : CommandProvider
{ {
Id = "WebSearch"; Id = "WebSearch";
DisplayName = Resources.extension_name; DisplayName = Resources.extension_name;
Icon = IconHelpers.FromRelativePath("Assets\\WebSearch.png"); Icon = Icons.WebSearch;
Settings = _settingsManager.Settings; Settings = _settingsManager.Settings;
_fallbackItem = new FallbackExecuteSearchItem(_settingsManager); _fallbackItem = new FallbackExecuteSearchItem(_settingsManager);

View File

@@ -20,7 +20,7 @@ public partial class WebSearchTopLevelCommandItem : CommandItem, IFallbackHandle
public WebSearchTopLevelCommandItem(SettingsManager settingsManager) public WebSearchTopLevelCommandItem(SettingsManager settingsManager)
: base(new WebSearchListPage(settingsManager)) : base(new WebSearchListPage(settingsManager))
{ {
Icon = IconHelpers.FromRelativePath("Assets\\WebSearch.png"); Icon = Icons.WebSearch;
SetDefaultTitle(); SetDefaultTitle();
_settingsManager = settingsManager; _settingsManager = settingsManager;
} }

View File

@@ -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
}

View File

@@ -24,14 +24,6 @@ public partial class InstallPackageCommand : InvokableCommand
public PackageInstallCommandState InstallCommandState { get; private set; } public PackageInstallCommandState InstallCommandState { get; private set; }
public static IconInfo CompletedIcon { get; } = new("\uE930"); // Completed
public static IconInfo UpdateIcon { get; } = new("\uE74A"); // Up
public static IconInfo DownloadIcon { get; } = new("\uE896"); // Download
public static IconInfo DeleteIcon { get; } = new("\uE74D"); // Delete
public event EventHandler<InstallPackageCommand>? InstallStateChanged; public event EventHandler<InstallPackageCommand>? InstallStateChanged;
private static readonly CompositeFormat UninstallingPackage = System.Text.CompositeFormat.Parse(Properties.Resources.winget_uninstalling_package); 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 Icon = InstallCommandState switch
{ {
PackageInstallCommandState.Install => DownloadIcon, PackageInstallCommandState.Install => Icons.DownloadIcon,
PackageInstallCommandState.Update => UpdateIcon, PackageInstallCommandState.Update => Icons.UpdateIcon,
PackageInstallCommandState.Uninstall => CompletedIcon, PackageInstallCommandState.Uninstall => Icons.CompletedIcon,
_ => throw new NotImplementedException(), _ => throw new NotImplementedException(),
}; };
Name = InstallCommandState switch Name = InstallCommandState switch

View File

@@ -190,7 +190,7 @@ public partial class InstallPackageListItem : ListItem
CommandContextItem uninstallContextItem = new(installCommand) CommandContextItem uninstallContextItem = new(installCommand)
{ {
IsCritical = true, IsCritical = true,
Icon = InstallPackageCommand.DeleteIcon, Icon = Icons.DeleteIcon,
}; };
if (WinGetStatics.AppSearchCallback != null) if (WinGetStatics.AppSearchCallback != null)

View File

@@ -34,17 +34,13 @@ internal sealed partial class WinGetExtensionPage : DynamicListPage, IDisposable
private IEnumerable<CatalogPackage>? _results; private IEnumerable<CatalogPackage>? _results;
public static IconInfo WinGetIcon { get; } = IconHelpers.FromRelativePath("Assets\\WinGet.svg");
public static IconInfo ExtensionsIcon { get; } = IconHelpers.FromRelativePath("Assets\\Extension.svg");
public static string ExtensionsTag => "windows-commandpalette-extension"; public static string ExtensionsTag => "windows-commandpalette-extension";
private readonly StatusMessage _errorMessage = new() { State = MessageState.Error }; private readonly StatusMessage _errorMessage = new() { State = MessageState.Error };
public WinGetExtensionPage(string tag = "") public WinGetExtensionPage(string tag = "")
{ {
Icon = tag == ExtensionsTag ? ExtensionsIcon : WinGetIcon; Icon = tag == ExtensionsTag ? Icons.ExtensionsIcon : Icons.WinGetIcon;
Name = Properties.Resources.winget_page_name; Name = Properties.Resources.winget_page_name;
_tag = tag; _tag = tag;
ShowDetails = true; ShowDetails = true;
@@ -78,7 +74,7 @@ internal sealed partial class WinGetExtensionPage : DynamicListPage, IDisposable
EmptyContent = new CommandItem(new NoOpCommand()) EmptyContent = new CommandItem(new NoOpCommand())
{ {
Icon = WinGetIcon, Icon = Icons.WinGetIcon,
Title = (string.IsNullOrEmpty(SearchText) && !HasTag) ? Title = (string.IsNullOrEmpty(SearchText) && !HasTag) ?
Properties.Resources.winget_placeholder_text : Properties.Resources.winget_placeholder_text :
Properties.Resources.winget_no_packages_found, Properties.Resources.winget_no_packages_found,
@@ -189,7 +185,7 @@ internal sealed partial class WinGetExtensionPage : DynamicListPage, IDisposable
return []; return [];
} }
string searchDebugText = $"{query}{(HasTag ? "+" : string.Empty)}{_tag}"; var searchDebugText = $"{query}{(HasTag ? "+" : string.Empty)}{_tag}";
Logger.LogDebug($"Starting search for '{searchDebugText}'"); Logger.LogDebug($"Starting search for '{searchDebugText}'");
HashSet<CatalogPackage> results = new(new PackageIdCompare()); HashSet<CatalogPackage> results = new(new PackageIdCompare());

View File

@@ -15,7 +15,7 @@ public partial class WinGetExtensionCommandsProvider : CommandProvider
{ {
DisplayName = Properties.Resources.winget_display_name; DisplayName = Properties.Resources.winget_display_name;
Id = "WinGet"; Id = "WinGet";
Icon = WinGetExtensionPage.WinGetIcon; Icon = Icons.WinGetIcon;
_ = WinGetStatics.Manager; _ = WinGetStatics.Manager;
} }
@@ -34,7 +34,7 @@ public partial class WinGetExtensionCommandsProvider : CommandProvider
new OpenUrlCommand("ms-windows-store://assoc/?Tags=AppExtension-com.microsoft.commandpalette")) new OpenUrlCommand("ms-windows-store://assoc/?Tags=AppExtension-com.microsoft.commandpalette"))
{ {
Title = Properties.Resources.winget_search_store_title, Title = Properties.Resources.winget_search_store_title,
Icon = IconHelpers.FromRelativePaths("Assets\\Store.light.svg", "Assets\\Store.dark.svg"), Icon = Icons.StoreIcon,
}, },
]; ];

View File

@@ -20,7 +20,7 @@ internal sealed partial class CloseWindowCommand : InvokableCommand
public CloseWindowCommand(Window window) public CloseWindowCommand(Window window)
{ {
Icon = new IconInfo("\uE894"); Icon = Icons.CloseWindow;
Name = $"{Resources.windowwalker_Close}"; Name = $"{Resources.windowwalker_Close}";
_window = window; _window = window;
} }

View File

@@ -21,7 +21,7 @@ internal sealed partial class EndTaskCommand : InvokableCommand
public EndTaskCommand(Window window) public EndTaskCommand(Window window)
{ {
Icon = new IconInfo("\uF140"); Icon = Icons.EndTask;
Name = $"{Resources.windowwalker_Kill}"; Name = $"{Resources.windowwalker_Kill}";
_window = window; _window = window;
} }

View File

@@ -119,7 +119,7 @@ internal static class ResultHelper
return new WindowWalkerListItem(null) return new WindowWalkerListItem(null)
{ {
Title = Resources.windowwalker_ExplorerInfoTitle, Title = Resources.windowwalker_ExplorerInfoTitle,
Icon = new IconInfo("\uE946"), // Info Icon = Icons.Info,
Subtitle = Resources.windowwalker_ExplorerInfoSubTitle, Subtitle = Resources.windowwalker_ExplorerInfoSubTitle,
Command = new ExplorerInfoResultCommand(), Command = new ExplorerInfoResultCommand(),
}; };

View File

@@ -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
}

View File

@@ -19,7 +19,7 @@ internal sealed partial class WindowWalkerListPage : DynamicListPage, IDisposabl
public WindowWalkerListPage() public WindowWalkerListPage()
{ {
Icon = IconHelpers.FromRelativePath("Assets\\WindowWalker.svg"); Icon = Icons.WindowWalkerIcon;
Name = Resources.windowwalker_name; Name = Resources.windowwalker_name;
Id = "com.microsoft.cmdpal.windowwalker"; Id = "com.microsoft.cmdpal.windowwalker";
PlaceholderText = Resources.windowwalker_PlaceholderText; PlaceholderText = Resources.windowwalker_PlaceholderText;

View File

@@ -20,7 +20,7 @@ public partial class WindowWalkerCommandsProvider : CommandProvider
{ {
Id = "WindowWalker"; Id = "WindowWalker";
DisplayName = Resources.windowwalker_name; DisplayName = Resources.windowwalker_name;
Icon = IconHelpers.FromRelativePath("Assets\\WindowWalker.svg"); Icon = Icons.WindowWalkerIcon;
Settings = SettingsManager.Instance.Settings; Settings = SettingsManager.Instance.Settings;
_windowWalkerPageItem = new CommandItem(new WindowWalkerListPage()) _windowWalkerPageItem = new CommandItem(new WindowWalkerListPage())

View File

@@ -25,7 +25,7 @@ internal sealed partial class OpenServicesCommand : InvokableCommand
{ {
_serviceResult = serviceResult; _serviceResult = serviceResult;
Name = Resources.wox_plugin_service_open_services; Name = Resources.wox_plugin_service_open_services;
Icon = new IconInfo("\xE8A7"); // OpenInNewWindow icon Icon = Icons.OpenIcon;
} }
public override CommandResult Invoke() public override CommandResult Invoke()

View File

@@ -25,7 +25,7 @@ internal sealed partial class RestartServiceCommand : InvokableCommand
{ {
_serviceResult = serviceResult; _serviceResult = serviceResult;
Name = Resources.wox_plugin_service_restart; Name = Resources.wox_plugin_service_restart;
Icon = new IconInfo("\xE72C"); // Refresh icon Icon = Icons.RefreshIcon;
} }
public override CommandResult Invoke() public override CommandResult Invoke()

View File

@@ -28,11 +28,11 @@ internal sealed partial class ServiceCommand : InvokableCommand
Name = action.ToString(); Name = action.ToString();
if (serviceResult.IsRunning) if (serviceResult.IsRunning)
{ {
Icon = new IconInfo("\xE71A"); // Stop icon Icon = Icons.StopIcon;
} }
else else
{ {
Icon = new IconInfo("\xEDB5"); // PlayBadge12 icon Icon = Icons.PlayIcon;
} }
} }

View File

@@ -73,16 +73,16 @@ public static class ServiceHelper
]; ];
} }
IconInfo icon = new("\U0001f7e2"); // unicode LARGE GREEN CIRCLE IconInfo icon = Icons.GreenCircleIcon;
switch (s.Status) switch (s.Status)
{ {
case ServiceControllerStatus.Stopped: case ServiceControllerStatus.Stopped:
icon = new("\U0001F534"); // unicode LARGE RED CIRCLE icon = Icons.RedCircleIcon;
break; break;
case ServiceControllerStatus.Running: case ServiceControllerStatus.Running:
break; break;
case ServiceControllerStatus.Paused: case ServiceControllerStatus.Paused:
icon = new("\u23F8"); // unicode DOUBLE VERTICAL BAR, aka, "Pause" icon = Icons.PauseIcon;
break; break;
} }

View File

@@ -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"
}

View File

@@ -14,7 +14,7 @@ internal sealed partial class ServicesListPage : DynamicListPage
{ {
public ServicesListPage() public ServicesListPage()
{ {
Icon = WindowsServicesCommandsProvider.ServicesIcon; Icon = Icons.ServicesIcon;
Name = "Windows Services"; Name = "Windows Services";
} }

View File

@@ -11,13 +11,11 @@ namespace Microsoft.CmdPal.Ext.WindowsServices;
public partial class WindowsServicesCommandsProvider : CommandProvider public partial class WindowsServicesCommandsProvider : CommandProvider
{ {
// For giggles, "%windir%\\system32\\filemgmt.dll" also _just works_. // For giggles, "%windir%\\system32\\filemgmt.dll" also _just works_.
public static IconInfo ServicesIcon { get; } = IconHelpers.FromRelativePath("Assets\\Services.svg");
public WindowsServicesCommandsProvider() public WindowsServicesCommandsProvider()
{ {
Id = "Windows.Services"; Id = "Windows.Services";
DisplayName = Resources.WindowsServicesProvider_DisplayName; DisplayName = Resources.WindowsServicesProvider_DisplayName;
Icon = ServicesIcon; Icon = Icons.ServicesIcon;
} }
public override ICommandItem[] TopLevelCommands() public override ICommandItem[] TopLevelCommands()

View File

@@ -10,7 +10,6 @@ using System.Resources;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.CmdPal.Ext.WindowsSettings.Classes; using Microsoft.CmdPal.Ext.WindowsSettings.Classes;
using Microsoft.CmdPal.Ext.WindowsSettings.Helpers;
using Microsoft.CmdPal.Ext.WindowsSettings.Properties; using Microsoft.CmdPal.Ext.WindowsSettings.Properties;
using Microsoft.CommandPalette.Extensions; using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit; using Microsoft.CommandPalette.Extensions.Toolkit;
@@ -27,7 +26,7 @@ internal sealed partial class CopySettingCommand : InvokableCommand
internal CopySettingCommand(WindowsSetting entry) internal CopySettingCommand(WindowsSetting entry)
{ {
Name = Resources.CopyCommand; Name = Resources.CopyCommand;
Icon = new IconInfo("\xE8C8"); // Copy icon Icon = Icons.CopyIcon;
_entry = entry; _entry = entry;
} }

View File

@@ -10,7 +10,6 @@ using System.Resources;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.CmdPal.Ext.WindowsSettings.Classes; using Microsoft.CmdPal.Ext.WindowsSettings.Classes;
using Microsoft.CmdPal.Ext.WindowsSettings.Helpers;
using Microsoft.CmdPal.Ext.WindowsSettings.Properties; using Microsoft.CmdPal.Ext.WindowsSettings.Properties;
using Microsoft.CommandPalette.Extensions; using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit; using Microsoft.CommandPalette.Extensions.Toolkit;
@@ -27,7 +26,7 @@ internal sealed partial class OpenSettingsCommand : InvokableCommand
internal OpenSettingsCommand(WindowsSetting entry) internal OpenSettingsCommand(WindowsSetting entry)
{ {
Name = Resources.OpenSettings; Name = Resources.OpenSettings;
Icon = new IconInfo("\xE8C8"); Icon = Icons.CopyIcon;
_entry = entry; _entry = entry;
} }

View File

@@ -8,7 +8,6 @@ using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Microsoft.CmdPal.Ext.WindowsSettings.Commands; using Microsoft.CmdPal.Ext.WindowsSettings.Commands;
using Microsoft.CmdPal.Ext.WindowsSettings.Helpers; using Microsoft.CmdPal.Ext.WindowsSettings.Helpers;
using Microsoft.CmdPal.Ext.WindowsSettings.Properties; using Microsoft.CmdPal.Ext.WindowsSettings.Properties;
@@ -30,7 +29,7 @@ internal static class ResultHelper
{ {
var result = new ListItem(new OpenSettingsCommand(entry)) var result = new ListItem(new OpenSettingsCommand(entry))
{ {
Icon = IconHelpers.FromRelativePath("Assets\\WindowsSettings.svg"), Icon = Icons.WindowsSettingsIcon,
Subtitle = entry.JoinedFullSettingsPath, Subtitle = entry.JoinedFullSettingsPath,
Title = entry.Name, Title = entry.Name,
MoreCommands = ContextMenuHelper.GetContextMenu(entry).ToArray(), MoreCommands = ContextMenuHelper.GetContextMenu(entry).ToArray(),

View File

@@ -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
}

View File

@@ -24,7 +24,7 @@ internal sealed partial class FallbackWindowsSettingsItem : FallbackCommandItem
public FallbackWindowsSettingsItem(Classes.WindowsSettings windowsSettings) public FallbackWindowsSettingsItem(Classes.WindowsSettings windowsSettings)
: base(new NoOpCommand(), Resources.settings_title) : base(new NoOpCommand(), Resources.settings_title)
{ {
Icon = IconHelpers.FromRelativePath("Assets\\WindowsSettings.svg"); Icon = Icons.WindowsSettingsIcon;
_windowsSettings = windowsSettings; _windowsSettings = windowsSettings;
} }
@@ -59,10 +59,10 @@ internal sealed partial class FallbackWindowsSettingsItem : FallbackCommandItem
Title = setting.Name; Title = setting.Name;
Subtitle = setting.JoinedFullSettingsPath; Subtitle = setting.JoinedFullSettingsPath;
Icon = IconHelpers.FromRelativePath("Assets\\WindowsSettings.svg"); Icon = Icons.WindowsSettingsIcon;
Command = new OpenSettingsCommand(setting) Command = new OpenSettingsCommand(setting)
{ {
Icon = IconHelpers.FromRelativePath("Assets\\WindowsSettings.svg"), Icon = Icons.WindowsSettingsIcon,
Name = setting.Name, Name = setting.Name,
}; };
@@ -80,7 +80,7 @@ internal sealed partial class FallbackWindowsSettingsItem : FallbackCommandItem
// us to the Windows Settings search page, prepopulated with this search. // us to the Windows Settings search page, prepopulated with this search.
var settingsPage = new WindowsSettingsListPage(_windowsSettings, query); var settingsPage = new WindowsSettingsListPage(_windowsSettings, query);
Title = string.Format(CultureInfo.CurrentCulture, _title, query); Title = string.Format(CultureInfo.CurrentCulture, _title, query);
Icon = IconHelpers.FromRelativePath("Assets\\WindowsSettings.svg"); Icon = Icons.WindowsSettingsIcon;
Subtitle = _subtitle; Subtitle = _subtitle;
Command = settingsPage; Command = settingsPage;

View File

@@ -19,7 +19,7 @@ internal sealed partial class WindowsSettingsListPage : DynamicListPage
public WindowsSettingsListPage(Classes.WindowsSettings windowsSettings) public WindowsSettingsListPage(Classes.WindowsSettings windowsSettings)
{ {
Icon = IconHelpers.FromRelativePath("Assets\\WindowsSettings.svg"); Icon = Icons.WindowsSettingsIcon;
Name = Resources.settings_title; Name = Resources.settings_title;
Id = "com.microsoft.cmdpal.windowsSettings"; Id = "com.microsoft.cmdpal.windowsSettings";
_windowsSettings = windowsSettings; _windowsSettings = windowsSettings;

View File

@@ -24,7 +24,7 @@ public partial class WindowsSettingsCommandsProvider : CommandProvider
{ {
Id = "Windows.Settings"; Id = "Windows.Settings";
DisplayName = Resources.WindowsSettingsProvider_DisplayName; DisplayName = Resources.WindowsSettingsProvider_DisplayName;
Icon = IconHelpers.FromRelativePath("Assets\\WindowsSettings.svg"); Icon = Icons.WindowsSettingsIcon;
_windowsSettings = JsonSettingsListHelper.ReadAllPossibleSettings(); _windowsSettings = JsonSettingsListHelper.ReadAllPossibleSettings();
_searchSettingsListItem = new CommandItem(new WindowsSettingsListPage(_windowsSettings)) _searchSettingsListItem = new CommandItem(new WindowsSettingsListPage(_windowsSettings))

View File

@@ -29,7 +29,7 @@ internal sealed partial class LaunchProfileAsAdminCommand : InvokableCommand
this._openQuake = openQuake; this._openQuake = openQuake;
this.Name = Resources.launch_profile_as_admin; 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) private void LaunchElevated(string id, string profile)

View File

@@ -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
}

View File

@@ -24,7 +24,7 @@ internal sealed partial class ProfilesListPage : ListPage
public ProfilesListPage(SettingsManager terminalSettings) public ProfilesListPage(SettingsManager terminalSettings)
{ {
Icon = WindowsTerminalCommandsProvider.TerminalIcon; Icon = Icons.TerminalIcon;
Name = Resources.profiles_list_page_name; Name = Resources.profiles_list_page_name;
_terminalSettings = terminalSettings; _terminalSettings = terminalSettings;
} }

View File

@@ -14,7 +14,7 @@ public partial class TerminalTopLevelCommandItem : CommandItem
public TerminalTopLevelCommandItem(SettingsManager settingsManager) public TerminalTopLevelCommandItem(SettingsManager settingsManager)
: base(new ProfilesListPage(settingsManager)) : base(new ProfilesListPage(settingsManager))
{ {
Icon = WindowsTerminalCommandsProvider.TerminalIcon; Icon = Icons.TerminalIcon;
Title = Resources.list_item_title; Title = Resources.list_item_title;
} }
} }

View File

@@ -14,13 +14,11 @@ public partial class WindowsTerminalCommandsProvider : CommandProvider
private readonly TerminalTopLevelCommandItem _terminalCommand; private readonly TerminalTopLevelCommandItem _terminalCommand;
private readonly SettingsManager _settingsManager = new(); private readonly SettingsManager _settingsManager = new();
public static IconInfo TerminalIcon { get; } = IconHelpers.FromRelativePath("Assets\\WindowsTerminal.svg");
public WindowsTerminalCommandsProvider() public WindowsTerminalCommandsProvider()
{ {
Id = "WindowsTerminalProfiles"; Id = "WindowsTerminalProfiles";
DisplayName = Resources.extension_name; DisplayName = Resources.extension_name;
Icon = TerminalIcon; Icon = Icons.TerminalIcon;
Settings = _settingsManager.Settings; Settings = _settingsManager.Settings;
_terminalCommand = new TerminalTopLevelCommandItem(_settingsManager) _terminalCommand = new TerminalTopLevelCommandItem(_settingsManager)