From 042ddab68e050dc06d5959534326327231bec9bc Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Tue, 4 Feb 2025 13:42:33 -0600 Subject: [PATCH] We don't need no stinkin runtimeclasses --- .../Commands/CopyPathCommand.cs | 2 +- .../Commands/OpenExplorerCommand.cs | 2 +- .../Commands/OpenFileCommand.cs | 2 +- .../Pages/EverythingExtensionPage.cs | 18 +++---- .../Commands/CommentCommand.cs | 2 +- .../Commands/LinkCommand.cs | 2 +- .../Pages/HackerNewsPage.cs | 2 +- .../MastodonExtensionPage.cs | 8 +-- .../MediaControlsExtension/MediaListItem.cs | 6 +-- .../Exts/Menus/MenusCommandsProvider.cs | 4 +- .../cmdpal/Exts/Menus/Pages/MenusPage.cs | 2 +- .../AllAppsCommandProvider.cs | 2 +- .../Microsoft.CmdPal.Ext.Apps/AllAppsPage.cs | 2 +- .../Microsoft.CmdPal.Ext.Apps/AppListItem.cs | 5 +- .../AddBookmarkPage.cs | 2 +- .../BookmarkPlaceholderPage.cs | 2 +- .../BookmarksCommandProvider.cs | 2 +- .../CalculatorCommandProvider.cs | 4 +- .../Commands/CopyPathCommand.cs | 2 +- .../Commands/OpenFileCommand.cs | 2 +- .../Commands/OpenInConsoleCommand.cs | 2 +- .../Commands/OpenPropertiesCommand.cs | 2 +- .../Commands/OpenWithCommand.cs | 2 +- .../Commands/ShowFileInFolderCommand.cs | 2 +- .../Pages/IndexerPage.cs | 4 +- .../Commands/CopyRegistryInfoCommand.cs | 6 +-- .../Commands/OpenKeyInEditorCommand.cs | 2 +- .../RegistryCommandsProvider.cs | 2 +- .../Commands/ExecuteItem.cs | 6 +-- .../Helpers/ShellListPageHelpers.cs | 6 +-- .../Pages/SettingsPage.cs | 2 +- .../Pages/ShellListPage.cs | 2 +- .../ShellCommandsProvider.cs | 4 +- .../Pages/SettingsPage.cs | 2 +- .../Pages/WebSearchListPage.cs | 8 +-- .../WebSearchTopLevelCommandItem.cs | 2 +- .../Commands/CloseWindowCommand.cs | 2 +- .../Commands/KillProcessCommand.cs | 2 +- .../Commands/SwitchToWindowCommand.cs | 2 +- .../Components/ContextMenuHelper.cs | 11 ++-- .../Components/ResultHelper.cs | 2 +- .../Pages/SettingsPage.cs | 2 +- .../Pages/WindowWalkerListPage.cs | 2 +- .../WindowWalkerCommandsProvider.cs | 2 +- .../Commands/OpenServicesCommand.cs | 2 +- .../Commands/RestartServiceCommand.cs | 2 +- .../Commands/ServiceCommand.cs | 4 +- .../Commands/CopySettingCommand.cs | 2 +- .../Commands/OpenSettingsCommand.cs | 2 +- .../Helpers/ResultHelper.cs | 2 +- .../Pages/WindowsSettingsListPage.cs | 2 +- .../WindowsSettingsCommandsProvider.cs | 2 +- .../Commands/LaunchProfileAsAdminCommand.cs | 2 +- .../Commands/LaunchProfileCommand.cs | 2 +- .../Pages/SettingsPage.cs | 2 +- .../Pages/PokedexExtensionPage.cs | 4 +- .../ProcessListPage.cs | 2 +- .../SwitchToProcess.cs | 2 +- .../TerminateProcess.cs | 2 +- .../Commands/LaunchSSHHostCommand.cs | 2 +- .../Commands/OpenConfigFileCommand.cs | 2 +- .../Pages/SSHHostsListPage.cs | 2 +- .../EvilSampleListPage.cs | 2 +- .../SamplePagesExtension/EvilSamplesPage.cs | 4 +- .../ExplodeInFiveSeconds.cs | 2 +- .../Pages/SampleContentPage.cs | 4 +- .../Pages/SampleDynamicListPage.cs | 2 +- .../Pages/SampleFormPage.cs | 2 +- .../Pages/SampleListPage.cs | 2 +- .../Pages/SampleListPageWithDetails.cs | 6 +-- .../Pages/SampleMarkdownPage.cs | 2 +- .../Pages/SampleSettingsPage.cs | 2 +- .../SamplePagesCommandsProvider.cs | 2 +- .../SampleUpdatingItemsPage.cs | 2 +- .../SamplePagesExtension/SamplesListPage.cs | 4 +- .../Exts/SpongebotExtension/SpongebotPage.cs | 2 +- .../SpongebotSettingsPage.cs | 2 +- .../Pages/TemplateExtensionPage.cs | 2 +- .../Pages/VirtualDesktopExtensionPage.cs | 4 +- .../YouTubeExtension/Pages/YouTubeAPIPage.cs | 2 +- .../Pages/YouTubeChannelInfoMarkdownPage.cs | 2 +- .../Pages/YouTubeChannelVideosPage.cs | 2 +- .../Pages/YouTubeChannelsPage.cs | 2 +- .../Pages/YouTubeVideoInfoMarkdownPage.cs | 2 +- .../Pages/YouTubeVideosPage.cs | 2 +- .../CommandItemViewModel.cs | 4 +- .../CommandProviderWrapper.cs | 23 ++++---- .../Commands/BuiltInsCommandProvider.cs | 2 +- .../Commands/LogMessagesPage.cs | 2 +- .../Commands/MainListPage.cs | 2 +- .../Commands/OpenSettingsCommand.cs | 2 +- .../Commands/QuitAction.cs | 2 +- .../Commands/ReloadExtensionsCommand.cs | 2 +- .../ContentMarkdownViewModel.cs | 2 +- .../ContentPageViewModel.cs | 2 +- .../ContentTreeViewModel.cs | 4 +- .../IconDataViewModel.cs | 6 +-- .../IconInfoViewModel.cs | 4 +- .../ListViewModel.cs | 2 +- .../PageViewModel.cs | 7 +-- .../ProgressViewModel.cs | 2 +- .../SettingsViewModel.cs | 3 +- .../StatusMessageViewModel.cs | 2 +- .../TopLevelCommandItemWrapper.cs | 2 +- .../TopLevelCommandManager.cs | 4 +- .../TopLevelCommandWrapper.cs | 7 +-- .../cmdpal/Microsoft.CmdPal.UI/App.xaml.cs | 2 +- .../Microsoft.CmdPal.UI/Controls/Tag.xaml.cs | 7 +-- .../ExtViews/IconCacheService.cs | 2 +- .../Microsoft.CmdPal.UI/MainWindow.xaml.cs | 12 ++--- .../Pages/ShellPage.xaml.cs | 2 +- .../CopyTextCommand.cs | 25 +++++++++ .../OpenUrlCommand.cs | 25 +++++++++ .../BaseObservable.cs | 2 +- .../Command.cs | 19 ++++--- .../CommandContextItem.cs | 2 +- .../CommandItem.cs | 30 ++++++----- .../CommandProvider.cs | 35 ++++--------- .../ContentPage.cs | 2 +- .../CopyTextCommand.cs | 2 +- .../Details.cs | 31 ++++++----- .../Filter.cs | 2 +- .../GlobalSuppressions.cs | 4 +- .../IconData.cs | 29 +++++++++++ .../IconInfo.cs | 32 ++++++++++++ .../ItemsChangedEventArgs.cs | 17 ++++++ .../KeyChordHelpers.cs | 21 ++++++++ .../ListPage.cs | 2 +- .../OpenUrlCommand.cs | 2 +- .../PropChangedEventArgs.cs | 17 ++++++ .../Tag.cs | 2 + .../TreeContent.cs | 2 +- .../Microsoft.CommandPalette.Extensions.idl | 52 +++++++++---------- ...icrosoft.CommandPalette.Extensions.vcxproj | 19 +++---- .../winrt_module.cpp | 50 ++++++++++++++++++ .../PrevNextTrackAction.cs | 4 +- .../PrevNextTrackCommand.cs | 4 +- .../TogglePlayMediaAction.cs | 2 +- .../TogglePlayMediaCommand.cs | 2 +- .../Microsoft.CmdPal.Ext.Apps/AppAction.cs | 2 +- .../Microsoft.CmdPal.Ext.Apps/AppCommand.cs | 2 +- .../UrlCommand.cs | 2 +- .../CalculatorCopyCommand.cs | 2 +- .../FallbackExecuteItem.cs | 2 +- .../Commands/SearchWebCommand.cs | 2 +- .../FallbackExecuteSearchItem.cs | 2 +- .../Pages/InstallPackageListItem.cs | 4 +- .../WinGetExtensionCommandsProvider.cs | 2 +- .../Pages/SampleCommentsPage.cs | 2 +- .../Pages/SampleMarkdownDetails.cs | 2 +- .../Pages/SampleMarkdownManyBodies.cs | 2 +- .../Commands/GetVideoInfoCommand.cs | 2 +- .../Commands/OpenChannelLinkCommand.cs | 2 +- .../Commands/OpenVideoLinkCommand.cs | 2 +- 154 files changed, 514 insertions(+), 315 deletions(-) create mode 100644 src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/CopyTextCommand.cs create mode 100644 src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/OpenUrlCommand.cs create mode 100644 src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/IconData.cs create mode 100644 src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/IconInfo.cs create mode 100644 src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/ItemsChangedEventArgs.cs create mode 100644 src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/KeyChordHelpers.cs create mode 100644 src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/PropChangedEventArgs.cs create mode 100644 src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions/winrt_module.cpp diff --git a/src/modules/cmdpal/Exts/EverythingExtension/Commands/CopyPathCommand.cs b/src/modules/cmdpal/Exts/EverythingExtension/Commands/CopyPathCommand.cs index b5554be36af1..5d91e6106fbc 100644 --- a/src/modules/cmdpal/Exts/EverythingExtension/Commands/CopyPathCommand.cs +++ b/src/modules/cmdpal/Exts/EverythingExtension/Commands/CopyPathCommand.cs @@ -14,7 +14,7 @@ internal CopyPathCommand(string fullname) { _fullname = fullname; Name = "Copy path"; - Icon = new("\ue8c8"); + Icon = new IconInfo("\ue8c8"); } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/Exts/EverythingExtension/Commands/OpenExplorerCommand.cs b/src/modules/cmdpal/Exts/EverythingExtension/Commands/OpenExplorerCommand.cs index 5a96e4b41f4a..b489890be4df 100644 --- a/src/modules/cmdpal/Exts/EverythingExtension/Commands/OpenExplorerCommand.cs +++ b/src/modules/cmdpal/Exts/EverythingExtension/Commands/OpenExplorerCommand.cs @@ -13,7 +13,7 @@ internal OpenExplorerCommand(string fullname) { _fullname = fullname; Name = "Open path"; - Icon = new("\uec50"); + Icon = new IconInfo("\uec50"); } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/Exts/EverythingExtension/Commands/OpenFileCommand.cs b/src/modules/cmdpal/Exts/EverythingExtension/Commands/OpenFileCommand.cs index f840b315ab6e..f9b95a951267 100644 --- a/src/modules/cmdpal/Exts/EverythingExtension/Commands/OpenFileCommand.cs +++ b/src/modules/cmdpal/Exts/EverythingExtension/Commands/OpenFileCommand.cs @@ -18,7 +18,7 @@ internal OpenFileCommand(string fullname, string path) _fullname = fullname; _path = path; Name = "Open file"; - Icon = new("\ue8e5"); + Icon = new IconInfo("\ue8e5"); } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/Exts/EverythingExtension/Pages/EverythingExtensionPage.cs b/src/modules/cmdpal/Exts/EverythingExtension/Pages/EverythingExtensionPage.cs index 456fa524adf1..5a6dc3d47f90 100644 --- a/src/modules/cmdpal/Exts/EverythingExtension/Pages/EverythingExtensionPage.cs +++ b/src/modules/cmdpal/Exts/EverythingExtension/Pages/EverythingExtensionPage.cs @@ -2,16 +2,11 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using System.Collections; using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; using Microsoft.CommandPalette.Extensions; using Microsoft.CommandPalette.Extensions.Toolkit; -using Windows.UI.ApplicationSettings; using static EverythingExtension.NativeMethods; namespace EverythingExtension; @@ -20,10 +15,9 @@ internal sealed partial class EverythingExtensionPage : DynamicListPage { public EverythingExtensionPage() { - Icon = new(File.Exists("C:\\Program Files\\Everything\\Everything.exe") ? + Icon = new IconInfo(File.Exists("C:\\Program Files\\Everything\\Everything.exe") ? "C:\\Program Files\\Everything\\Everything.exe" : - "C:\\Program Files (x86)\\Everything\\Everything.exe" - ); + "C:\\Program Files (x86)\\Everything\\Everything.exe"); Name = "Everything"; Everything_SetRequestFlags(Request.FILE_NAME | Request.PATH); @@ -57,9 +51,11 @@ public override IListItem[] GetItems() (uint)EverythingErrors.EVERYTHING_ERROR_INVALIDCALL => "Invalid call", _ => "Unexpected error", }; - List items = new List(); - items.Add(new ListItem(new NoOpCommand() { Name = "Failed to query. Error was:" })); - items.Add(new ListItem(new NoOpCommand()) { Title = message, Subtitle = $"0x{lastError:X8}" }); + List items = + [ + new ListItem(new NoOpCommand() { Name = "Failed to query. Error was:" }), + new ListItem(new NoOpCommand()) { Title = message, Subtitle = $"0x{lastError:X8}" }, + ]; if (lastError == (uint)EverythingErrors.EVERYTHING_ERROR_IPC) { items.Add(new ListItem(new NoOpCommand() { Name = "(Are you sure Everything is running?)" })); diff --git a/src/modules/cmdpal/Exts/HackerNewsExtension/Commands/CommentCommand.cs b/src/modules/cmdpal/Exts/HackerNewsExtension/Commands/CommentCommand.cs index 3781f264cb5f..989612935ce5 100644 --- a/src/modules/cmdpal/Exts/HackerNewsExtension/Commands/CommentCommand.cs +++ b/src/modules/cmdpal/Exts/HackerNewsExtension/Commands/CommentCommand.cs @@ -16,7 +16,7 @@ internal CommentCommand(NewsPost post) { _post = post; Name = "Open comments"; - Icon = new("\ue8f2"); // chat bubbles + Icon = new IconInfo("\ue8f2"); // chat bubbles } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/Exts/HackerNewsExtension/Commands/LinkCommand.cs b/src/modules/cmdpal/Exts/HackerNewsExtension/Commands/LinkCommand.cs index e5e489bd04db..83c194f78ee4 100644 --- a/src/modules/cmdpal/Exts/HackerNewsExtension/Commands/LinkCommand.cs +++ b/src/modules/cmdpal/Exts/HackerNewsExtension/Commands/LinkCommand.cs @@ -16,7 +16,7 @@ internal LinkCommand(NewsPost post) { _post = post; Name = "Open link"; - Icon = new("\uE8A7"); + Icon = new IconInfo("\uE8A7"); } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/Exts/HackerNewsExtension/Pages/HackerNewsPage.cs b/src/modules/cmdpal/Exts/HackerNewsExtension/Pages/HackerNewsPage.cs index edfcdca3f7c2..0df11193b22c 100644 --- a/src/modules/cmdpal/Exts/HackerNewsExtension/Pages/HackerNewsPage.cs +++ b/src/modules/cmdpal/Exts/HackerNewsExtension/Pages/HackerNewsPage.cs @@ -20,7 +20,7 @@ internal sealed partial class HackerNewsPage : ListPage { public HackerNewsPage() { - Icon = new("https://news.ycombinator.com/favicon.ico"); + Icon = new IconInfo("https://news.ycombinator.com/favicon.ico"); Name = "Hacker News"; AccentColor = ColorHelpers.FromRgb(255, 102, 0); IsLoading = true; diff --git a/src/modules/cmdpal/Exts/MastodonExtension/MastodonExtensionPage.cs b/src/modules/cmdpal/Exts/MastodonExtension/MastodonExtensionPage.cs index b18546bdb4db..4e32ef5385f0 100644 --- a/src/modules/cmdpal/Exts/MastodonExtension/MastodonExtensionPage.cs +++ b/src/modules/cmdpal/Exts/MastodonExtension/MastodonExtensionPage.cs @@ -27,7 +27,7 @@ internal sealed partial class MastodonExtensionPage : ListPage public MastodonExtensionPage() { - Icon = new("https://mastodon.social/packs/media/icons/android-chrome-36x36-4c61fdb42936428af85afdbf8c6a45a8.png"); + Icon = new IconInfo("https://mastodon.social/packs/media/icons/android-chrome-36x36-4c61fdb42936428af85afdbf8c6a45a8.png"); Name = "Mastodon"; ShowDetails = true; HasMoreItems = true; @@ -45,20 +45,20 @@ private void AddPosts(List posts) { Title = p.Account.DisplayName, // p.ContentAsPlainText(), Subtitle = $"@{p.Account.Username}", - Icon = new(p.Account.Avatar), + Icon = new IconInfo(p.Account.Avatar), // * Tags = [ new Tag() { - Icon = new("\ue734"), // FavoriteStar + Icon = new IconInfo("\ue734"), // FavoriteStar Background = ColorHelpers.FromRgb(255, 255, 0), // Yellow Foreground = ColorHelpers.FromRgb(64, 64, 0), // Dark Yellow Text = p.Favorites.ToString(CultureInfo.CurrentCulture), }, new Tag() { - Icon = new("\ue8ee"), // RepeatAll + Icon = new IconInfo("\ue8ee"), // RepeatAll Background = ColorHelpers.FromRgb(86, 58, 204), // Mastodon color Foreground = ColorHelpers.FromRgb(255, 255, 255), // White Text = p.Boosts.ToString(CultureInfo.CurrentCulture), diff --git a/src/modules/cmdpal/Exts/MediaControlsExtension/MediaListItem.cs b/src/modules/cmdpal/Exts/MediaControlsExtension/MediaListItem.cs index dd1c5d507592..a2b5088a75ea 100644 --- a/src/modules/cmdpal/Exts/MediaControlsExtension/MediaListItem.cs +++ b/src/modules/cmdpal/Exts/MediaControlsExtension/MediaListItem.cs @@ -41,7 +41,7 @@ private async Task UpdateProperties() if (properties == null) { var a = (TogglePlayMediaCommand)this.Command; - a.Icon = new(string.Empty); + a.Icon = new IconInfo(string.Empty); a.Name = "No media playing"; return; @@ -57,12 +57,12 @@ private async Task UpdateProperties() var internalAction = (TogglePlayMediaCommand)this.Command; if (status == GlobalSystemMediaTransportControlsSessionPlaybackStatus.Paused) { - internalAction.Icon = new("\ue768"); // play + internalAction.Icon = new IconInfo("\ue768"); // play internalAction.Name = "Paused"; } else if (status == GlobalSystemMediaTransportControlsSessionPlaybackStatus.Playing) { - internalAction.Icon = new("\ue769"); // pause + internalAction.Icon = new IconInfo("\ue769"); // pause internalAction.Name = "Playing"; } diff --git a/src/modules/cmdpal/Exts/Menus/MenusCommandsProvider.cs b/src/modules/cmdpal/Exts/Menus/MenusCommandsProvider.cs index 7e31135d1b66..7986b57fc0d6 100644 --- a/src/modules/cmdpal/Exts/Menus/MenusCommandsProvider.cs +++ b/src/modules/cmdpal/Exts/Menus/MenusCommandsProvider.cs @@ -174,7 +174,7 @@ internal sealed partial class WindowMenusPage : ListPage public WindowMenusPage(WindowData window) { _window = window; - Icon = new(string.Empty); + Icon = new IconInfo(string.Empty); Name = window.Title; ShowDetails = false; } @@ -192,7 +192,7 @@ internal sealed partial class AllWindowsPage : ListPage public AllWindowsPage() { - Icon = new("\uf0b5"); // ChecklistMirrored + Icon = new IconInfo("\uf0b5"); // ChecklistMirrored Name = "Open Windows"; ShowDetails = false; } diff --git a/src/modules/cmdpal/Exts/Menus/Pages/MenusPage.cs b/src/modules/cmdpal/Exts/Menus/Pages/MenusPage.cs index fb13f1d00234..0bc865022fa6 100644 --- a/src/modules/cmdpal/Exts/Menus/Pages/MenusPage.cs +++ b/src/modules/cmdpal/Exts/Menus/Pages/MenusPage.cs @@ -12,7 +12,7 @@ internal sealed partial class MenusPage : ListPage { public MenusPage() { - Icon = new(string.Empty); + Icon = new IconInfo(string.Empty); Name = "Menus from the open windows"; } diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Apps/AllAppsCommandProvider.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Apps/AllAppsCommandProvider.cs index e9bc33b340cb..b04d15e69a3a 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Apps/AllAppsCommandProvider.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Apps/AllAppsCommandProvider.cs @@ -18,7 +18,7 @@ public AllAppsCommandProvider() { Id = "AllApps"; DisplayName = "Installed apps"; - Icon = new("\ue71d"); + Icon = new IconInfo("\ue71d"); _listItem = new(Page) { Subtitle = "Search installed apps" }; } diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Apps/AllAppsPage.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Apps/AllAppsPage.cs index 2e1002a6a8f9..5c09e4391806 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Apps/AllAppsPage.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Apps/AllAppsPage.cs @@ -17,7 +17,7 @@ public AllAppsPage() { StringMatcher.Instance = new StringMatcher(); this.Name = "All Apps"; - this.Icon = new("\ue71d"); + this.Icon = new IconInfo("\ue71d"); this.ShowDetails = true; this.IsLoading = true; this.PlaceholderText = "Search installed apps..."; diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Apps/AppListItem.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Apps/AppListItem.cs index d0512212fb54..1f928efde6ca 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Apps/AppListItem.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Apps/AppListItem.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.CommandPalette.Extensions; using Microsoft.CommandPalette.Extensions.Toolkit; namespace Microsoft.CmdPal.Ext.Apps.Programs; @@ -11,7 +10,7 @@ internal sealed partial class AppListItem : ListItem { private readonly AppItem _app; private static readonly Tag _appTag = new("App"); - private static readonly IconInfo _openPathIcon = new("\ue838"); + private static readonly IconInfo _openPathIcon = new IconInfo("\ue838"); public AppListItem(AppItem app) : base(new AppCommand(app)) @@ -24,7 +23,7 @@ public AppListItem(AppItem app) Details = new Details() { Title = this.Title, - HeroImage = Command?.Icon ?? new(string.Empty), + HeroImage = ((AppCommand)Command!).Icon ?? new IconInfo(string.Empty), Body = "### App", }; diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/AddBookmarkPage.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/AddBookmarkPage.cs index 7c3522a3e056..ba6af787dbc7 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/AddBookmarkPage.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/AddBookmarkPage.cs @@ -22,7 +22,7 @@ internal sealed partial class AddBookmarkPage : FormPage public AddBookmarkPage() { - this.Icon = new("\ued0e"); + this.Icon = new IconInfo("\ued0e"); this.Name = "Add a Bookmark"; } } diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkPlaceholderPage.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkPlaceholderPage.cs index 4fb01967b25a..bd2c4af97475 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkPlaceholderPage.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkPlaceholderPage.cs @@ -16,7 +16,7 @@ internal sealed partial class BookmarkPlaceholderPage : FormPage public BookmarkPlaceholderPage(string name, string url, string type) { Name = name; - Icon = new(UrlCommand.IconFromUrl(url, type)); + Icon = new IconInfo(UrlCommand.IconFromUrl(url, type)); _bookmarkPlaceholder = new BookmarkPlaceholderForm(name, url, type); } } diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarksCommandProvider.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarksCommandProvider.cs index 25c050e37cd3..468408ff6e50 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarksCommandProvider.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarksCommandProvider.cs @@ -20,7 +20,7 @@ public BookmarksCommandProvider() { Id = "Bookmarks"; DisplayName = "Bookmarks"; - Icon = new("\uE718"); // Pin + Icon = new IconInfo("\uE718"); // Pin _addNewCommand.AddedCommand += AddNewCommand_AddedCommand; } diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorCommandProvider.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorCommandProvider.cs index 9cd4b020a28f..52b3ba7ddd91 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorCommandProvider.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorCommandProvider.cs @@ -20,7 +20,7 @@ public CalculatorCommandProvider() { Id = "Calculator"; DisplayName = "Calculator"; - Icon = new("\ue8ef"); // Calculator + Icon = new IconInfo("\ue8ef"); // Calculator } public override ICommandItem[] TopLevelCommands() => [_listItem]; @@ -41,7 +41,7 @@ public sealed partial class CalculatorListPage : DynamicListPage public CalculatorListPage() { - Icon = new("\ue8ef"); // Calculator + Icon = new IconInfo("\ue8ef"); // Calculator Name = "Calculator"; PlaceholderText = "Type an equation..."; Id = "com.microsoft.cmdpal.calculator"; diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/CopyPathCommand.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/CopyPathCommand.cs index 3907fcabc101..a93e421514af 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/CopyPathCommand.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/CopyPathCommand.cs @@ -17,7 +17,7 @@ internal CopyPathCommand(IndexerItem item) { this._item = item; this.Name = Resources.Indexer_Command_CopyPath; - this.Icon = new("\uE8c8"); + this.Icon = new IconInfo("\uE8c8"); } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/OpenFileCommand.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/OpenFileCommand.cs index 034353f49fb9..490f3b8cd814 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/OpenFileCommand.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/OpenFileCommand.cs @@ -19,7 +19,7 @@ internal OpenFileCommand(IndexerItem item) { this._item = item; this.Name = Resources.Indexer_Command_OpenFile; - this.Icon = new("\uE8E5"); + this.Icon = new IconInfo("\uE8E5"); } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/OpenInConsoleCommand.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/OpenInConsoleCommand.cs index 3f9dc8e2f32c..cd9c5ce94b4e 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/OpenInConsoleCommand.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/OpenInConsoleCommand.cs @@ -20,7 +20,7 @@ internal OpenInConsoleCommand(IndexerItem item) { this._item = item; this.Name = Resources.Indexer_Command_OpenPathInConsole; - this.Icon = new("\uE756"); + this.Icon = new IconInfo("\uE756"); } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/OpenPropertiesCommand.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/OpenPropertiesCommand.cs index 36f1332d743d..a6611cf6b3fd 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/OpenPropertiesCommand.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/OpenPropertiesCommand.cs @@ -52,7 +52,7 @@ internal OpenPropertiesCommand(IndexerItem item) { this._item = item; this.Name = Resources.Indexer_Command_OpenProperties; - this.Icon = new("\uE90F"); + this.Icon = new IconInfo("\uE90F"); } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/OpenWithCommand.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/OpenWithCommand.cs index cdf487540d6c..a9c431d32c8b 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/OpenWithCommand.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/OpenWithCommand.cs @@ -50,7 +50,7 @@ internal OpenWithCommand(IndexerItem item) { this._item = item; this.Name = Resources.Indexer_Command_OpenWith; - this.Icon = new("\uE7AC"); + this.Icon = new IconInfo("\uE7AC"); } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/ShowFileInFolderCommand.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/ShowFileInFolderCommand.cs index 316bd2b86ac4..2a94b77a3c71 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/ShowFileInFolderCommand.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Commands/ShowFileInFolderCommand.cs @@ -20,7 +20,7 @@ internal ShowFileInFolderCommand(IndexerItem item) { this._item = item; this.Name = Resources.Indexer_Command_ShowInFolder; - this.Icon = new("\uE838"); + this.Icon = new IconInfo("\uE838"); } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Pages/IndexerPage.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Pages/IndexerPage.cs index 252c4aee11f6..ae7dc29a23a6 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Pages/IndexerPage.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Indexer/Pages/IndexerPage.cs @@ -26,7 +26,7 @@ internal sealed partial class IndexerPage : DynamicListPage, IDisposable public IndexerPage() { Id = "com.microsoft.indexer.fileSearch"; - Icon = new("\uEC50"); + Icon = new IconInfo("\uEC50"); Name = Resources.Indexer_Title; PlaceholderText = Resources.Indexer_PlaceholderText; @@ -96,7 +96,7 @@ private void FetchItems(int limit) FullPath = result.LaunchUri, }) { - Icon = new(result.IsFolder ? "\uE838" : "\uE8E5"), + Icon = new IconInfo(result.IsFolder ? "\uE838" : "\uE8E5"), }); } diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Registry/Commands/CopyRegistryInfoCommand.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Registry/Commands/CopyRegistryInfoCommand.cs index f714647b2c3b..b291e5512f1e 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Registry/Commands/CopyRegistryInfoCommand.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Registry/Commands/CopyRegistryInfoCommand.cs @@ -21,19 +21,19 @@ internal CopyRegistryInfoCommand(RegistryEntry entry, CopyType typeToCopy) if (typeToCopy == CopyType.Key) { Name = Resources.CopyKeyNamePath; - Icon = new("\xE8C8"); // Copy Icon + Icon = new IconInfo("\xE8C8"); // Copy Icon _stringToCopy = entry.GetRegistryKey(); } else if (typeToCopy == CopyType.ValueData) { Name = Resources.CopyValueData; - Icon = new("\xF413"); // CopyTo Icon + Icon = new IconInfo("\xF413"); // CopyTo Icon _stringToCopy = entry.GetValueData(); } else if (typeToCopy == CopyType.ValueName) { Name = Resources.CopyValueName; - Icon = new("\xE8C8"); // Copy Icon + Icon = new IconInfo("\xE8C8"); // Copy Icon _stringToCopy = entry.GetValueNameWithKey(); } diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Registry/Commands/OpenKeyInEditorCommand.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Registry/Commands/OpenKeyInEditorCommand.cs index 16a90f8f2228..d10b99431884 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Registry/Commands/OpenKeyInEditorCommand.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Registry/Commands/OpenKeyInEditorCommand.cs @@ -26,7 +26,7 @@ internal sealed partial class OpenKeyInEditorCommand : InvokableCommand internal OpenKeyInEditorCommand(RegistryEntry entry) { Name = Resources.OpenKeyInRegistryEditor; - Icon = new("\xE8A7"); // OpenInNewWindow icon + Icon = new IconInfo("\xE8A7"); // OpenInNewWindow icon _entry = entry; } diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Registry/RegistryCommandsProvider.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Registry/RegistryCommandsProvider.cs index d8e75fd5e5cb..94e9dde75fdf 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Registry/RegistryCommandsProvider.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Registry/RegistryCommandsProvider.cs @@ -13,7 +13,7 @@ public RegistryCommandsProvider() { Id = "Windows.Registry"; DisplayName = $"Windows Registry"; - Icon = new("\uE74C"); // OEM + Icon = new IconInfo("\uE74C"); // OEM } public override ICommandItem[] TopLevelCommands() diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/Commands/ExecuteItem.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/Commands/ExecuteItem.cs index da3a1079f57d..3bc1ec09d7f3 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/Commands/ExecuteItem.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/Commands/ExecuteItem.cs @@ -26,17 +26,17 @@ public ExecuteItem(string cmd, SettingsManager settings, RunAsType type = RunAsT if (type == RunAsType.Administrator) { Name = Properties.Resources.cmd_run_as_administrator; - Icon = new("\xE7EF"); // Admin Icon + Icon = new IconInfo("\xE7EF"); // Admin Icon } else if (type == RunAsType.OtherUser) { Name = Properties.Resources.cmd_run_as_user; - Icon = new("\xE7EE"); // User Icon + Icon = new IconInfo("\xE7EE"); // User Icon } else { Name = Properties.Resources.generic_run_command; - Icon = new("\uE751"); // Return Key Icon + Icon = new IconInfo("\uE751"); // Return Key Icon } Cmd = cmd; diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/Helpers/ShellListPageHelpers.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/Helpers/ShellListPageHelpers.cs index a575699ee85d..4ce9076e803d 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/Helpers/ShellListPageHelpers.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/Helpers/ShellListPageHelpers.cs @@ -30,7 +30,7 @@ private ListItem GetCurrentCmd(string cmd) { Title = cmd, Subtitle = Properties.Resources.cmd_plugin_name + ": " + Properties.Resources.cmd_execute_through_shell, - Icon = new(string.Empty), + Icon = new IconInfo(string.Empty), }; return result; @@ -55,7 +55,7 @@ private List GetHistoryCmds(string cmd, ListItem result) // Using CurrentCulture since this is user facing Subtitle = Properties.Resources.cmd_plugin_name + ": " + string.Format(CultureInfo.CurrentCulture, CmdHasBeenExecutedTimes, m.Value), - Icon = new("\uE81C"), + Icon = new IconInfo("\uE81C"), }; return ret; }).Where(o => o != null).Take(4); @@ -108,7 +108,7 @@ private List ResultsFromlHistory() // Using CurrentCulture since this is user facing Subtitle = Properties.Resources.cmd_plugin_name + ": " + string.Format(CultureInfo.CurrentCulture, CmdHasBeenExecutedTimes, m.Value), - Icon = new("\uE81C"), + Icon = new IconInfo("\uE81C"), }).Take(5); return history.ToList(); diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/Pages/SettingsPage.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/Pages/SettingsPage.cs index d6c76c97f17e..92c2c95f1262 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/Pages/SettingsPage.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/Pages/SettingsPage.cs @@ -22,7 +22,7 @@ public override IForm[] Forms() public SettingsPage(SettingsManager settingsManager) { Name = Properties.Resources.settings_page_name; - Icon = new("\uE713"); // Settings icon + Icon = new IconInfo("\uE713"); // Settings icon _settings = settingsManager.Settings; _settingsManager = settingsManager; diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/Pages/ShellListPage.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/Pages/ShellListPage.cs index 0f2cb3277823..4bc5a5a8e61d 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/Pages/ShellListPage.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/Pages/ShellListPage.cs @@ -15,7 +15,7 @@ internal sealed partial class ShellListPage : DynamicListPage public ShellListPage(SettingsManager settingsManager) { - Icon = new("\uE756"); + Icon = new IconInfo("\uE756"); Id = "com.microsoft.cmdpal.shell"; Name = Resources.cmd_plugin_name; PlaceholderText = Resources.list_placeholder_text; diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/ShellCommandsProvider.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/ShellCommandsProvider.cs index d9d8c32786be..893e971a6ce0 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/ShellCommandsProvider.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Shell/ShellCommandsProvider.cs @@ -20,13 +20,13 @@ public ShellCommandsProvider() { Id = "Run"; DisplayName = Resources.cmd_plugin_name; - Icon = new("\uE756"); + Icon = new IconInfo("\uE756"); _fallbackItem = new FallbackExecuteItem(_settingsManager); _shellPageItem = new CommandItem(new ShellListPage(_settingsManager)) { - Icon = new("\uE756"), + Icon = new IconInfo("\uE756"), Title = Resources.shell_command_name, Subtitle = Resources.cmd_plugin_description, MoreCommands = [new CommandContextItem(new SettingsPage(_settingsManager))], diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WebSearch/Pages/SettingsPage.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WebSearch/Pages/SettingsPage.cs index 096c8064d8f5..46f4a5cbce14 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WebSearch/Pages/SettingsPage.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WebSearch/Pages/SettingsPage.cs @@ -23,7 +23,7 @@ public override IForm[] Forms() public SettingsPage(SettingsManager settingsManager) { Name = Resources.settings_page_name; - Icon = new("\uE713"); // Settings icon + Icon = new IconInfo("\uE713"); // Settings icon _settings = settingsManager.Settings; _settingsManager = settingsManager; diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WebSearch/Pages/WebSearchListPage.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WebSearch/Pages/WebSearchListPage.cs index b55b65347906..5ceb6892c2a2 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WebSearch/Pages/WebSearchListPage.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WebSearch/Pages/WebSearchListPage.cs @@ -30,10 +30,10 @@ public WebSearchListPage(SettingsManager settingsManager) Name = Resources.command_item_title; Title = Resources.command_item_title; PlaceholderText = Resources.plugin_description; - Icon = new("\uF6FA"); // WebSearch icon + Icon = new IconInfo("\uF6FA"); // WebSearch icon allItems = [new(new NoOpCommand()) { - Icon = new("\uF6FA"), + Icon = new IconInfo("\uF6FA"), Title = Properties.Resources.plugin_description, Subtitle = string.Format(CultureInfo.CurrentCulture, PluginOpen, BrowserInfo.Name ?? BrowserInfo.MSEdgeName), } @@ -66,7 +66,7 @@ public List Query(string query) { Title = Properties.Resources.plugin_description, Subtitle = string.Format(CultureInfo.CurrentCulture, PluginInBrowserName, BrowserInfo.Name ?? BrowserInfo.MSEdgeName), - Icon = new(_iconPath), + Icon = new IconInfo(_iconPath), }); } else @@ -76,7 +76,7 @@ public List Query(string query) { Title = searchTerm, Subtitle = string.Format(CultureInfo.CurrentCulture, PluginOpen, BrowserInfo.Name ?? BrowserInfo.MSEdgeName), - Icon = new(_iconPath), + Icon = new IconInfo(_iconPath), }; results.Add(result); } diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WebSearch/WebSearchTopLevelCommandItem.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WebSearch/WebSearchTopLevelCommandItem.cs index 135d8364c649..831536fa4095 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WebSearch/WebSearchTopLevelCommandItem.cs +++ b/src/modules/cmdpal/Exts/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 = new("\uf6fa"); // WebSearch icon + Icon = new IconInfo("\uf6fa"); // WebSearch icon SetDefaultTitle(); _settingsManager = settingsManager; } diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Commands/CloseWindowCommand.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Commands/CloseWindowCommand.cs index de3fcbe3322e..46475fafd0aa 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Commands/CloseWindowCommand.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Commands/CloseWindowCommand.cs @@ -20,7 +20,7 @@ internal sealed partial class CloseWindowCommand : InvokableCommand public CloseWindowCommand(Window window) { - Icon = new("\xE8BB"); + Icon = new IconInfo("\xE8BB"); Name = $"{Resources.windowwalker_Close}"; _window = window; } diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Commands/KillProcessCommand.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Commands/KillProcessCommand.cs index 7c19ed50d261..5559e1428d1a 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Commands/KillProcessCommand.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Commands/KillProcessCommand.cs @@ -21,7 +21,7 @@ internal sealed partial class KillProcessCommand : InvokableCommand public KillProcessCommand(Window window) { - Icon = new("\xE74D"); // Delete symbol + Icon = new IconInfo("\xE74D"); // Delete symbol Name = $"{Resources.windowwalker_Kill}"; _window = window; } diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Commands/SwitchToWindowCommand.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Commands/SwitchToWindowCommand.cs index 282199fdd652..0bfc1e039621 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Commands/SwitchToWindowCommand.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Commands/SwitchToWindowCommand.cs @@ -26,7 +26,7 @@ public SwitchToWindowCommand(Window? window) try { var processFileName = p.MainModule?.FileName; - Icon = new(processFileName); + Icon = new IconInfo(processFileName); } catch { diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Components/ContextMenuHelper.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Components/ContextMenuHelper.cs index d56392cce218..cbadadc699f6 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Components/ContextMenuHelper.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Components/ContextMenuHelper.cs @@ -4,11 +4,8 @@ using System; using System.Collections.Generic; -using System.Windows; -using ABI.Microsoft.CommandPalette.Extensions; using Microsoft.CmdPal.Ext.WindowWalker.Commands; using Microsoft.CmdPal.Ext.WindowWalker.Helpers; -using Microsoft.CmdPal.Ext.WindowWalker.Properties; using Microsoft.CommandPalette.Extensions.Toolkit; using Windows.System; @@ -18,16 +15,16 @@ internal sealed class ContextMenuHelper { internal static List GetContextMenuResults(in WindowWalkerListItem listItem) { - if (!(listItem?.Window is Window windowData)) + if (listItem?.Window is not Window windowData) { - return new List(0); + return []; } var contextMenu = new List() { new(new CloseWindowCommand(windowData)) { - RequestedShortcut = new(true, false, false, false, (int)VirtualKey.F4, 0), + RequestedShortcut = KeyChordHelpers.FromModifiers(true, false, false, false, (int)VirtualKey.F4, 0), }, }; @@ -38,7 +35,7 @@ internal static List GetContextMenuResults(in WindowWalkerLi { contextMenu.Add(new CommandContextItem(new KillProcessCommand(windowData)) { - RequestedShortcut = new(true, false, false, false, (int)VirtualKey.Delete, 0), + RequestedShortcut = KeyChordHelpers.FromModifiers(true, false, false, false, (int)VirtualKey.Delete, 0), }); } diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Components/ResultHelper.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Components/ResultHelper.cs index e17560d4ec3c..092f1544de8b 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Components/ResultHelper.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Components/ResultHelper.cs @@ -119,7 +119,7 @@ private static WindowWalkerListItem GetExplorerInfoResult() return new WindowWalkerListItem(null) { Title = Resources.windowwalker_ExplorerInfoTitle, - Icon = new("\uE946"), // Info + Icon = new IconInfo("\uE946"), // Info Subtitle = Resources.windowwalker_ExplorerInfoSubTitle, Command = new ExplorerInfoResultCommand(), }; diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Pages/SettingsPage.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Pages/SettingsPage.cs index 7016a16293cf..4c58a203b781 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Pages/SettingsPage.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Pages/SettingsPage.cs @@ -23,7 +23,7 @@ public override IForm[] Forms() public SettingsPage() { Name = Resources.windowwalker_settings_name; - Icon = new("\uE713"); // Settings icon + Icon = new IconInfo("\uE713"); // Settings icon _settingsManager = SettingsManager.Instance; _settings = _settingsManager.Settings; diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Pages/WindowWalkerListPage.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Pages/WindowWalkerListPage.cs index 0fdfbce60fb1..ef061d900a14 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Pages/WindowWalkerListPage.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/Pages/WindowWalkerListPage.cs @@ -19,7 +19,7 @@ internal sealed partial class WindowWalkerListPage : DynamicListPage, IDisposabl public WindowWalkerListPage() { - Icon = new("\ue8f9"); // SwitchApps + Icon = new IconInfo("\ue8f9"); // SwitchApps Name = Resources.windowwalker_name; Id = "com.microsoft.cmdpal.windowwalker"; PlaceholderText = Resources.windowwalker_PlaceholderText; diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/WindowWalkerCommandsProvider.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/WindowWalkerCommandsProvider.cs index a2587e46f8c9..9429b9a7d2d2 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/WindowWalkerCommandsProvider.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowWalker/WindowWalkerCommandsProvider.cs @@ -20,7 +20,7 @@ public WindowWalkerCommandsProvider() { Id = "WindowWalker"; DisplayName = Resources.windowwalker_name; - Icon = new("\ue8f9"); // SwitchApps + Icon = new IconInfo("\ue8f9"); // SwitchApps _windowWalkerPageItem = new CommandItem(new WindowWalkerListPage()) { diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Commands/OpenServicesCommand.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Commands/OpenServicesCommand.cs index 9009bfbf6f2f..312a3fc33dee 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Commands/OpenServicesCommand.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Commands/OpenServicesCommand.cs @@ -25,7 +25,7 @@ internal OpenServicesCommand(ServiceResult serviceResult) { _serviceResult = serviceResult; Name = Resources.wox_plugin_service_open_services; - Icon = new("\xE8A7"); // OpenInNewWindow icon + Icon = new IconInfo("\xE8A7"); // OpenInNewWindow icon } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Commands/RestartServiceCommand.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Commands/RestartServiceCommand.cs index be75327ee476..48b2a861eefa 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Commands/RestartServiceCommand.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Commands/RestartServiceCommand.cs @@ -25,7 +25,7 @@ internal RestartServiceCommand(ServiceResult serviceResult) { _serviceResult = serviceResult; Name = Resources.wox_plugin_service_restart; - Icon = new("\xE72C"); // Refresh icon + Icon = new IconInfo("\xE72C"); // Refresh icon } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Commands/ServiceCommand.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Commands/ServiceCommand.cs index acf40bb52019..29a59fafaa1c 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Commands/ServiceCommand.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Commands/ServiceCommand.cs @@ -28,11 +28,11 @@ internal ServiceCommand(ServiceResult serviceResult, Action action) Name = action.ToString(); if (serviceResult.IsRunning) { - Icon = new("\xE71A"); // Stop icon + Icon = new IconInfo("\xE71A"); // Stop icon } else { - Icon = new("\xEDB5"); // Playbadge12 icon + Icon = new IconInfo("\xEDB5"); // Playbadge12 icon } } diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/Commands/CopySettingCommand.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/Commands/CopySettingCommand.cs index 9689d0621707..7f5fa1789e44 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/Commands/CopySettingCommand.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/Commands/CopySettingCommand.cs @@ -27,7 +27,7 @@ internal sealed partial class CopySettingCommand : InvokableCommand internal CopySettingCommand(WindowsSetting entry) { Name = Resources.CopyCommand; - Icon = new("\xE8C8"); // Copy icon + Icon = new IconInfo("\xE8C8"); // Copy icon _entry = entry; } diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/Commands/OpenSettingsCommand.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/Commands/OpenSettingsCommand.cs index a3b4ac24d791..9460cd9240ac 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/Commands/OpenSettingsCommand.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/Commands/OpenSettingsCommand.cs @@ -27,7 +27,7 @@ internal sealed partial class OpenSettingsCommand : InvokableCommand internal OpenSettingsCommand(WindowsSetting entry) { Name = Resources.OpenSettings; - Icon = new("\xE8C8"); + Icon = new IconInfo("\xE8C8"); _entry = entry; } diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/Helpers/ResultHelper.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/Helpers/ResultHelper.cs index e4f3eb88ee52..47794ab8884b 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/Helpers/ResultHelper.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/Helpers/ResultHelper.cs @@ -32,7 +32,7 @@ internal static List GetResultList( { var result = new ListItem(new OpenSettingsCommand(entry)) { - Icon = new(iconPath), + Icon = new IconInfo(iconPath), Subtitle = entry.JoinedFullSettingsPath, Title = entry.Name, MoreCommands = ContextMenuHelper.GetContextMenu(entry).ToArray(), diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/Pages/WindowsSettingsListPage.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/Pages/WindowsSettingsListPage.cs index 4da6cf4014d0..6cdd0fd5c7e6 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/Pages/WindowsSettingsListPage.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/Pages/WindowsSettingsListPage.cs @@ -18,7 +18,7 @@ internal sealed partial class WindowsSettingsListPage : DynamicListPage public WindowsSettingsListPage(Classes.WindowsSettings windowsSettings) { - Icon = new("\uE713"); // Settings + Icon = new IconInfo("\uE713"); // Settings Name = "Windows Settings"; Id = "com.microsoft.cmdpal.windowsSettings"; _defaultIconPath = "Images/WindowsSettings.light.png"; diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettingsCommandsProvider.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettingsCommandsProvider.cs index faf351fd34bd..ec580af1804d 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettingsCommandsProvider.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettingsCommandsProvider.cs @@ -20,7 +20,7 @@ public WindowsSettingsCommandsProvider() { Id = "Windows.Settings"; DisplayName = $"Windows Settings"; - Icon = new("\uE713"); // Settings + Icon = new IconInfo("\uE713"); // Settings _windowsSettings = JsonSettingsListHelper.ReadAllPossibleSettings(); _searchSettingsListItem = new CommandItem(new WindowsSettingsListPage(_windowsSettings)) diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsTerminal/Commands/LaunchProfileAsAdminCommand.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsTerminal/Commands/LaunchProfileAsAdminCommand.cs index 1679233902fa..fd8354495a08 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsTerminal/Commands/LaunchProfileAsAdminCommand.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsTerminal/Commands/LaunchProfileAsAdminCommand.cs @@ -32,7 +32,7 @@ internal LaunchProfileAsAdminCommand(string id, string profile, bool openNewTab, this._openQuake = openQuake; this.Name = Resources.launch_profile_as_admin; - this.Icon = new("\xE7EF"); // Admin icon + this.Icon = new IconInfo("\xE7EF"); // Admin icon } private void LaunchElevated(string id, string profile) diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsTerminal/Commands/LaunchProfileCommand.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsTerminal/Commands/LaunchProfileCommand.cs index 1850b70c8db4..25124fb33c80 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsTerminal/Commands/LaunchProfileCommand.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsTerminal/Commands/LaunchProfileCommand.cs @@ -32,7 +32,7 @@ internal LaunchProfileCommand(string id, string profile, string iconPath, bool o this._openQuake = openQuake; this.Name = Resources.launch_profile; - this.Icon = new(iconPath); + this.Icon = new IconInfo(iconPath); } private void Launch(string id, string profile) diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsTerminal/Pages/SettingsPage.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsTerminal/Pages/SettingsPage.cs index b15e5767c3fa..a17aa19464d1 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsTerminal/Pages/SettingsPage.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsTerminal/Pages/SettingsPage.cs @@ -23,7 +23,7 @@ public override IForm[] Forms() public SettingsPage(SettingsManager settingsManager) { Name = Resources.settings_page_name; - Icon = new("\uE713"); // Settings icon + Icon = new IconInfo("\uE713"); // Settings icon _settings = settingsManager.Settings; _settingsManager = settingsManager; diff --git a/src/modules/cmdpal/Exts/PokedexExtension/Pages/PokedexExtensionPage.cs b/src/modules/cmdpal/Exts/PokedexExtension/Pages/PokedexExtensionPage.cs index 9a1400687c41..8e5a6cda2425 100644 --- a/src/modules/cmdpal/Exts/PokedexExtension/Pages/PokedexExtensionPage.cs +++ b/src/modules/cmdpal/Exts/PokedexExtension/Pages/PokedexExtensionPage.cs @@ -60,7 +60,7 @@ public PokemonListItem(Pokemon p) { Pokemon = p; Title = Pokemon.Name; - Icon = new(Pokemon.IconUrl); + Icon = new IconInfo(Pokemon.IconUrl); Subtitle = $"#{Pokemon.Number}"; Tags = Pokemon.Types.Select(t => new Tag() { Text = t, Background = PokedexExtensionPage.GetColorForType(t) }).ToArray(); } @@ -468,7 +468,7 @@ internal sealed partial class PokedexExtensionPage : ListPage public PokedexExtensionPage() { - Icon = new("https://e7.pngegg.com/pngimages/311/5/png-clipart-pokedex-pokemon-go-hoenn-pokemon-x-and-y-hoenn-pokedex-pokemon-ash-thumbnail.png"); + Icon = new IconInfo("https://e7.pngegg.com/pngimages/311/5/png-clipart-pokedex-pokemon-go-hoenn-pokemon-x-and-y-hoenn-pokedex-pokemon-ash-thumbnail.png"); Name = "Pokedex"; } diff --git a/src/modules/cmdpal/Exts/ProcessMonitorExtension/ProcessListPage.cs b/src/modules/cmdpal/Exts/ProcessMonitorExtension/ProcessListPage.cs index 54adc15f1dac..dc218f6230df 100644 --- a/src/modules/cmdpal/Exts/ProcessMonitorExtension/ProcessListPage.cs +++ b/src/modules/cmdpal/Exts/ProcessMonitorExtension/ProcessListPage.cs @@ -15,7 +15,7 @@ internal sealed partial class ProcessListPage : ListPage { public ProcessListPage() { - this.Icon = new("\ue9d9"); + this.Icon = new IconInfo("\ue9d9"); this.Name = "Process Monitor"; } diff --git a/src/modules/cmdpal/Exts/ProcessMonitorExtension/SwitchToProcess.cs b/src/modules/cmdpal/Exts/ProcessMonitorExtension/SwitchToProcess.cs index 232d5c2e2dae..28ed75598a32 100644 --- a/src/modules/cmdpal/Exts/ProcessMonitorExtension/SwitchToProcess.cs +++ b/src/modules/cmdpal/Exts/ProcessMonitorExtension/SwitchToProcess.cs @@ -18,7 +18,7 @@ internal sealed partial class SwitchToProcess : InvokableCommand public SwitchToProcess(ProcessItem process) { this.process = process; - this.Icon = new(process.ExePath == string.Empty ? "\uE7B8" : process.ExePath); + this.Icon = new IconInfo(process.ExePath == string.Empty ? "\uE7B8" : process.ExePath); this.Name = "Switch to"; } diff --git a/src/modules/cmdpal/Exts/ProcessMonitorExtension/TerminateProcess.cs b/src/modules/cmdpal/Exts/ProcessMonitorExtension/TerminateProcess.cs index 081db7edf254..0dd9914c590d 100644 --- a/src/modules/cmdpal/Exts/ProcessMonitorExtension/TerminateProcess.cs +++ b/src/modules/cmdpal/Exts/ProcessMonitorExtension/TerminateProcess.cs @@ -16,7 +16,7 @@ public TerminateProcess(ProcessItem process, ProcessListPage owner) { _process = process; _owner = owner; - Icon = new("\ue74d"); + Icon = new IconInfo("\ue74d"); Name = "End task"; } diff --git a/src/modules/cmdpal/Exts/SSHKeychainExtension/Commands/LaunchSSHHostCommand.cs b/src/modules/cmdpal/Exts/SSHKeychainExtension/Commands/LaunchSSHHostCommand.cs index 47991fc84ba7..3202c6a4b7b0 100644 --- a/src/modules/cmdpal/Exts/SSHKeychainExtension/Commands/LaunchSSHHostCommand.cs +++ b/src/modules/cmdpal/Exts/SSHKeychainExtension/Commands/LaunchSSHHostCommand.cs @@ -22,7 +22,7 @@ internal LaunchSSHHostCommand(SSHKeychainItem host) { this._host = host; this.Name = "Connect"; - this.Icon = new("\uE8A7"); + this.Icon = new IconInfo("\uE8A7"); } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/Exts/SSHKeychainExtension/Commands/OpenConfigFileCommand.cs b/src/modules/cmdpal/Exts/SSHKeychainExtension/Commands/OpenConfigFileCommand.cs index 4c751976cb89..a1b3a1219c67 100644 --- a/src/modules/cmdpal/Exts/SSHKeychainExtension/Commands/OpenConfigFileCommand.cs +++ b/src/modules/cmdpal/Exts/SSHKeychainExtension/Commands/OpenConfigFileCommand.cs @@ -24,7 +24,7 @@ internal OpenConfigFileCommand(string configFilePath) this.Name = "Open Config File"; // TODO: Add Icon for OpenConfigFileCommand - this.Icon = new("\uE8A7"); + this.Icon = new IconInfo("\uE8A7"); } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/Exts/SSHKeychainExtension/Pages/SSHHostsListPage.cs b/src/modules/cmdpal/Exts/SSHKeychainExtension/Pages/SSHHostsListPage.cs index 7ff7a24077e5..70ad906c39e3 100644 --- a/src/modules/cmdpal/Exts/SSHKeychainExtension/Pages/SSHHostsListPage.cs +++ b/src/modules/cmdpal/Exts/SSHKeychainExtension/Pages/SSHHostsListPage.cs @@ -28,7 +28,7 @@ internal sealed partial class SSHHostsListPage : ListPage public SSHHostsListPage() { - Icon = new("https://cdn-icons-png.flaticon.com/512/5558/5558264.png"); + Icon = new IconInfo("https://cdn-icons-png.flaticon.com/512/5558/5558264.png"); Name = "SSH Keychain"; } diff --git a/src/modules/cmdpal/Exts/SamplePagesExtension/EvilSampleListPage.cs b/src/modules/cmdpal/Exts/SamplePagesExtension/EvilSampleListPage.cs index 86e7c7402e51..3be5882aa3f1 100644 --- a/src/modules/cmdpal/Exts/SamplePagesExtension/EvilSampleListPage.cs +++ b/src/modules/cmdpal/Exts/SamplePagesExtension/EvilSampleListPage.cs @@ -11,7 +11,7 @@ internal sealed partial class EvilSampleListPage : ListPage { public EvilSampleListPage() { - Icon = new(string.Empty); + Icon = new IconInfo(string.Empty); Name = "Open"; Title = "Evil Sample Page"; } diff --git a/src/modules/cmdpal/Exts/SamplePagesExtension/EvilSamplesPage.cs b/src/modules/cmdpal/Exts/SamplePagesExtension/EvilSamplesPage.cs index 15ca89d90241..8fa8bec87bd5 100644 --- a/src/modules/cmdpal/Exts/SamplePagesExtension/EvilSamplesPage.cs +++ b/src/modules/cmdpal/Exts/SamplePagesExtension/EvilSamplesPage.cs @@ -67,7 +67,7 @@ public partial class EvilSamplesPage : ListPage public EvilSamplesPage() { Name = "Evil Samples"; - Icon = new("👿"); // Info + Icon = new IconInfo("👿"); // Info } public override IListItem[] GetItems() => _commands; @@ -94,7 +94,7 @@ public override string Title public ExplodeOnPropChange() { - Icon = new(string.Empty); + Icon = new IconInfo(string.Empty); Name = "Open"; } diff --git a/src/modules/cmdpal/Exts/SamplePagesExtension/ExplodeInFiveSeconds.cs b/src/modules/cmdpal/Exts/SamplePagesExtension/ExplodeInFiveSeconds.cs index 6a4a56ec1926..41301099cf51 100644 --- a/src/modules/cmdpal/Exts/SamplePagesExtension/ExplodeInFiveSeconds.cs +++ b/src/modules/cmdpal/Exts/SamplePagesExtension/ExplodeInFiveSeconds.cs @@ -26,7 +26,7 @@ internal sealed partial class ExplodeInFiveSeconds : ListPage public ExplodeInFiveSeconds(bool repeat) { _repeat = repeat; - Icon = new(string.Empty); + Icon = new IconInfo(string.Empty); Name = "Open"; } diff --git a/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleContentPage.cs b/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleContentPage.cs index 2ec37192b7e5..09234460d33d 100644 --- a/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleContentPage.cs +++ b/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleContentPage.cs @@ -19,7 +19,7 @@ internal sealed partial class SampleContentPage : ContentPage public SampleContentPage() { Name = "Sample Content"; - Icon = new(string.Empty); + Icon = new IconInfo(string.Empty); } } @@ -308,7 +308,7 @@ internal sealed partial class SampleTreeContentPage : ContentPage public SampleTreeContentPage() { Name = Title = "Sample Content"; - Icon = new("\uE81E"); + Icon = new IconInfo("\uE81E"); myContentTree = new() { diff --git a/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleDynamicListPage.cs b/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleDynamicListPage.cs index 0a2821ea4f0c..c284c7d784ef 100644 --- a/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleDynamicListPage.cs +++ b/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleDynamicListPage.cs @@ -13,7 +13,7 @@ internal sealed partial class SampleDynamicListPage : DynamicListPage { public SampleDynamicListPage() { - Icon = new(string.Empty); + Icon = new IconInfo(string.Empty); Name = "Dynamic List"; IsLoading = true; } diff --git a/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleFormPage.cs b/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleFormPage.cs index baa1cf99eb75..f11af958c70b 100644 --- a/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleFormPage.cs +++ b/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleFormPage.cs @@ -16,6 +16,6 @@ internal sealed partial class SampleFormPage : FormPage public SampleFormPage() { Name = "Sample Form"; - Icon = new(string.Empty); + Icon = new IconInfo(string.Empty); } } diff --git a/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleListPage.cs b/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleListPage.cs index b19449d3827b..0867c1919b1c 100644 --- a/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleListPage.cs +++ b/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleListPage.cs @@ -11,7 +11,7 @@ internal sealed partial class SampleListPage : ListPage { public SampleListPage() { - Icon = new("\uEA37"); + Icon = new IconInfo("\uEA37"); Name = "Sample List Page"; } diff --git a/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleListPageWithDetails.cs b/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleListPageWithDetails.cs index 358a35379160..2cd9a1120712 100644 --- a/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleListPageWithDetails.cs +++ b/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleListPageWithDetails.cs @@ -12,7 +12,7 @@ internal sealed partial class SampleListPageWithDetails : ListPage { public SampleListPageWithDetails() { - Icon = new("\uE8A0"); + Icon = new IconInfo("\uE8A0"); Name = Title = "Sample List Page with Details"; this.ShowDetails = true; } @@ -115,8 +115,8 @@ public override IListItem[] GetItems() new Tag("Colored text") { Foreground = ColorHelpers.FromRgb(255, 0, 0) }, new Tag("Colored backgrounds") { Background = ColorHelpers.FromRgb(0, 0, 255) }, new Tag("Colored everything") { Foreground = ColorHelpers.FromRgb(255, 255, 0), Background = ColorHelpers.FromRgb(0, 0, 255) }, - new Tag("Icons too") { Icon = new("\uE735"), Foreground = ColorHelpers.FromRgb(255, 255, 0) }, - new Tag() { Icon = new("https://i.imgur.com/t9qgDTM.png") }, + new Tag("Icons too") { Icon = new IconInfo("\uE735"), Foreground = ColorHelpers.FromRgb(255, 255, 0) }, + new Tag() { Icon = new IconInfo("https://i.imgur.com/t9qgDTM.png") }, new Tag("this") { Foreground = RandomColor(), Background = RandomColor() }, new Tag("baby") { Foreground = RandomColor(), Background = RandomColor() }, new Tag("can") { Foreground = RandomColor(), Background = RandomColor() }, diff --git a/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleMarkdownPage.cs b/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleMarkdownPage.cs index 148080b014e6..963d8e42c704 100644 --- a/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleMarkdownPage.cs +++ b/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleMarkdownPage.cs @@ -163,7 +163,7 @@ Indenting by 4 spaces will turn an entire paragraph into a code-block. public SampleMarkdownPage() { - Icon = new(string.Empty); + Icon = new IconInfo(string.Empty); Name = "Sample Markdown Page"; } diff --git a/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleSettingsPage.cs b/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleSettingsPage.cs index 9c3c1c94528d..e33b39a4c5cd 100644 --- a/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleSettingsPage.cs +++ b/src/modules/cmdpal/Exts/SamplePagesExtension/Pages/SampleSettingsPage.cs @@ -31,7 +31,7 @@ public override IForm[] Forms() public SampleSettingsPage() { Name = "Sample Settings"; - Icon = new(string.Empty); + Icon = new IconInfo(string.Empty); _settings.Add(new ToggleSetting("onOff", true) { Label = "This is a toggle", diff --git a/src/modules/cmdpal/Exts/SamplePagesExtension/SamplePagesCommandsProvider.cs b/src/modules/cmdpal/Exts/SamplePagesExtension/SamplePagesCommandsProvider.cs index 8d698dac9d77..e500c25d8dee 100644 --- a/src/modules/cmdpal/Exts/SamplePagesExtension/SamplePagesCommandsProvider.cs +++ b/src/modules/cmdpal/Exts/SamplePagesExtension/SamplePagesCommandsProvider.cs @@ -12,7 +12,7 @@ public partial class SamplePagesCommandsProvider : CommandProvider public SamplePagesCommandsProvider() { DisplayName = "Sample Pages Commands"; - Icon = new("\uE82D"); + Icon = new IconInfo("\uE82D"); } private readonly ICommandItem[] _commands = [ diff --git a/src/modules/cmdpal/Exts/SamplePagesExtension/SampleUpdatingItemsPage.cs b/src/modules/cmdpal/Exts/SamplePagesExtension/SampleUpdatingItemsPage.cs index 5eb8b4572f00..e393d93000d9 100644 --- a/src/modules/cmdpal/Exts/SamplePagesExtension/SampleUpdatingItemsPage.cs +++ b/src/modules/cmdpal/Exts/SamplePagesExtension/SampleUpdatingItemsPage.cs @@ -19,7 +19,7 @@ public partial class SampleUpdatingItemsPage : ListPage public SampleUpdatingItemsPage() { Name = "Open"; - Icon = new(string.Empty); + Icon = new IconInfo(string.Empty); } public override IListItem[] GetItems() diff --git a/src/modules/cmdpal/Exts/SamplePagesExtension/SamplesListPage.cs b/src/modules/cmdpal/Exts/SamplePagesExtension/SamplesListPage.cs index f0ea79fd8a7e..4e06ea580a4d 100644 --- a/src/modules/cmdpal/Exts/SamplePagesExtension/SamplesListPage.cs +++ b/src/modules/cmdpal/Exts/SamplePagesExtension/SamplesListPage.cs @@ -48,7 +48,7 @@ public partial class SamplesListPage : ListPage { Title = "Sample of nested comments", Subtitle = "Demo of using nested trees of content to create a comment thread-like experience", - Icon = new("\uE90A"), // Comment + Icon = new IconInfo("\uE90A"), // Comment }, // DEPRECATED: Markdown pages @@ -94,7 +94,7 @@ public partial class SamplesListPage : ListPage public SamplesListPage() { Name = "Samples"; - Icon = new("\ue946"); // Info + Icon = new IconInfo("\ue946"); // Info } public override IListItem[] GetItems() => _commands; diff --git a/src/modules/cmdpal/Exts/SpongebotExtension/SpongebotPage.cs b/src/modules/cmdpal/Exts/SpongebotExtension/SpongebotPage.cs index 6c69160e27d1..4a7038e747be 100644 --- a/src/modules/cmdpal/Exts/SpongebotExtension/SpongebotPage.cs +++ b/src/modules/cmdpal/Exts/SpongebotExtension/SpongebotPage.cs @@ -21,7 +21,7 @@ public SpongebotPage() { Name = string.Empty; - Icon = new("https://imgflip.com/s/meme/Mocking-Spongebob.jpg"); + Icon = new IconInfo("https://imgflip.com/s/meme/Mocking-Spongebob.jpg"); Commands = [new CommandContextItem(CopyCommand)]; } diff --git a/src/modules/cmdpal/Exts/SpongebotExtension/SpongebotSettingsPage.cs b/src/modules/cmdpal/Exts/SpongebotExtension/SpongebotSettingsPage.cs index 3625d4c217e6..51579fd4659d 100644 --- a/src/modules/cmdpal/Exts/SpongebotExtension/SpongebotSettingsPage.cs +++ b/src/modules/cmdpal/Exts/SpongebotExtension/SpongebotSettingsPage.cs @@ -16,6 +16,6 @@ internal sealed partial class SpongebotSettingsPage : FormPage public SpongebotSettingsPage() { Name = "Settings"; - Icon = new("https://imgflip.com/s/meme/Mocking-Spongebob.jpg"); + Icon = new IconInfo("https://imgflip.com/s/meme/Mocking-Spongebob.jpg"); } } diff --git a/src/modules/cmdpal/Exts/TemplateExtension/Pages/TemplateExtensionPage.cs b/src/modules/cmdpal/Exts/TemplateExtension/Pages/TemplateExtensionPage.cs index 5d36f56aeb7b..777d08531e78 100644 --- a/src/modules/cmdpal/Exts/TemplateExtension/Pages/TemplateExtensionPage.cs +++ b/src/modules/cmdpal/Exts/TemplateExtension/Pages/TemplateExtensionPage.cs @@ -12,7 +12,7 @@ internal sealed partial class TemplateExtensionPage : ListPage { public TemplateExtensionPage() { - Icon = new(string.Empty); + Icon = new IconInfo(string.Empty); Name = "TemplateDisplayName"; } diff --git a/src/modules/cmdpal/Exts/VirtualDesktopExtension/Pages/VirtualDesktopExtensionPage.cs b/src/modules/cmdpal/Exts/VirtualDesktopExtension/Pages/VirtualDesktopExtensionPage.cs index 9f8b3c627207..a2744b74f3dd 100644 --- a/src/modules/cmdpal/Exts/VirtualDesktopExtension/Pages/VirtualDesktopExtensionPage.cs +++ b/src/modules/cmdpal/Exts/VirtualDesktopExtension/Pages/VirtualDesktopExtensionPage.cs @@ -17,7 +17,7 @@ internal sealed partial class VirtualDesktopExtensionPage : ListPage { public VirtualDesktopExtensionPage() { - Icon = new(string.Empty); + Icon = new IconInfo(string.Empty); Name = "Virtual Desktops"; Id = "com.zadjii.VirtualDesktopsList"; } @@ -44,7 +44,7 @@ public override IListItem[] GetItems() { Title = d.Name, Subtitle = $"Desktop {d.Index + 1}", - Icon = new(d.Wallpaper), + Icon = new IconInfo(d.Wallpaper), Tags = d.IsVisible ? [new Tag() { Text = "Current" }] : [], }; items.Add(li); diff --git a/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeAPIPage.cs b/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeAPIPage.cs index e0527e927e27..d0629c6b14c3 100644 --- a/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeAPIPage.cs +++ b/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeAPIPage.cs @@ -21,6 +21,6 @@ internal sealed partial class YouTubeAPIPage : FormPage public YouTubeAPIPage() { Name = "Edit YouTube API Key"; - Icon = new("https://www.youtube.com/favicon.ico"); + Icon = new IconInfo("https://www.youtube.com/favicon.ico"); } } diff --git a/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeChannelInfoMarkdownPage.cs b/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeChannelInfoMarkdownPage.cs index 52ac5d588599..8c443069d135 100644 --- a/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeChannelInfoMarkdownPage.cs +++ b/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeChannelInfoMarkdownPage.cs @@ -19,7 +19,7 @@ internal sealed partial class YouTubeChannelInfoMarkdownPage : MarkdownPage public YouTubeChannelInfoMarkdownPage(YouTubeChannel channel) { - Icon = new("\uE946"); + Icon = new IconInfo("\uE946"); Name = "See more information about this channel"; _channel = channel; } diff --git a/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeChannelVideosPage.cs b/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeChannelVideosPage.cs index 54fc4834fda5..02e39293c4e2 100644 --- a/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeChannelVideosPage.cs +++ b/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeChannelVideosPage.cs @@ -24,7 +24,7 @@ internal sealed partial class YouTubeChannelVideosPage : DynamicListPage public YouTubeChannelVideosPage(string channelId = null, string channelName = null) { - Icon = new("https://www.youtube.com/favicon.ico"); + Icon = new IconInfo("https://www.youtube.com/favicon.ico"); Name = $"Search for Videos by {channelName ?? "Channel"}"; this.ShowDetails = true; diff --git a/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeChannelsPage.cs b/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeChannelsPage.cs index b95728011b28..f0d77ec2d6fc 100644 --- a/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeChannelsPage.cs +++ b/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeChannelsPage.cs @@ -20,7 +20,7 @@ internal sealed partial class YouTubeChannelsPage : DynamicListPage { public YouTubeChannelsPage() { - Icon = new("https://www.youtube.com/favicon.ico"); + Icon = new IconInfo("https://www.youtube.com/favicon.ico"); Name = "YouTube (Channel Search)"; this.ShowDetails = true; } diff --git a/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeVideoInfoMarkdownPage.cs b/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeVideoInfoMarkdownPage.cs index a1e33438bad8..8f209d0e3014 100644 --- a/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeVideoInfoMarkdownPage.cs +++ b/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeVideoInfoMarkdownPage.cs @@ -20,7 +20,7 @@ internal sealed partial class YouTubeVideoInfoMarkdownPage : MarkdownPage public YouTubeVideoInfoMarkdownPage(YouTubeVideo video) { - Icon = new("\uE946"); + Icon = new IconInfo("\uE946"); Name = "See more information about this video"; _video = video; } diff --git a/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeVideosPage.cs b/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeVideosPage.cs index 6ad994ed0ee4..7d5be739526d 100644 --- a/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeVideosPage.cs +++ b/src/modules/cmdpal/Exts/YouTubeExtension/Pages/YouTubeVideosPage.cs @@ -21,7 +21,7 @@ internal sealed partial class YouTubeVideosPage : DynamicListPage { public YouTubeVideosPage() { - Icon = new("https://www.youtube.com/favicon.ico"); + Icon = new IconInfo("https://www.youtube.com/favicon.ico"); Name = "YouTube (Video Search)"; this.ShowDetails = true; } diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandItemViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandItemViewModel.cs index e115a49daba4..2433e2471305 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandItemViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandItemViewModel.cs @@ -135,14 +135,14 @@ public bool SafeInitializeProperties() Title = "Error"; Subtitle = "Item failed to load"; MoreCommands = []; - Icon = new(new("❌")); // new("❌"); + Icon = new(new IconInfo("❌")); // new("❌"); Icon.InitializeProperties(); } return false; } - private void Model_PropChanged(object sender, PropChangedEventArgs args) + private void Model_PropChanged(object sender, IPropChangedEventArgs args) { try { diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandProviderWrapper.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandProviderWrapper.cs index bcf47c0108f0..6881c4e1230d 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandProviderWrapper.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandProviderWrapper.cs @@ -12,31 +12,29 @@ namespace Microsoft.CmdPal.UI.ViewModels; public sealed class CommandProviderWrapper { - public bool IsExtension => extensionWrapper != null; + public bool IsExtension => Extension != null; private readonly bool isValid; private readonly ExtensionObject _commandProvider; - private readonly IExtensionWrapper? extensionWrapper; - public ICommandItem[] TopLevelItems { get; private set; } = []; public IFallbackCommandItem[] FallbackItems { get; private set; } = []; public string DisplayName { get; private set; } = string.Empty; - public IExtensionWrapper? Extension => extensionWrapper; + public IExtensionWrapper? Extension { get; } public CommandPaletteHost ExtensionHost { get; private set; } - public event TypedEventHandler? CommandsChanged; + public event TypedEventHandler? CommandsChanged; public string Id { get; private set; } = string.Empty; public IconInfoViewModel Icon { get; private set; } = new(null); - public string ProviderId => $"{extensionWrapper?.PackageFamilyName ?? string.Empty}/{Id}"; + public string ProviderId => $"{Extension?.PackageFamilyName ?? string.Empty}/{Id}"; public CommandProviderWrapper(ICommandProvider provider) { @@ -59,9 +57,9 @@ public CommandProviderWrapper(ICommandProvider provider) public CommandProviderWrapper(IExtensionWrapper extension) { - extensionWrapper = extension; + Extension = extension; ExtensionHost = new CommandPaletteHost(extension); - if (!extensionWrapper.IsRunning()) + if (!Extension.IsRunning()) { throw new ArgumentException("You forgot to start the extension. This is a coding error - make sure to call StartExtensionAsync"); } @@ -90,7 +88,7 @@ public CommandProviderWrapper(IExtensionWrapper extension) catch (Exception e) { Debug.WriteLine("Failed to initialize CommandProvider for extension."); - Debug.WriteLine($"Extension was {extensionWrapper!.PackageFamilyName}"); + Debug.WriteLine($"Extension was {Extension!.PackageFamilyName}"); Debug.WriteLine(e); } @@ -126,7 +124,7 @@ public async Task LoadTopLevelCommands() catch (Exception e) { Debug.WriteLine("Failed to load commands from extension"); - Debug.WriteLine($"Extension was {extensionWrapper!.PackageFamilyName}"); + Debug.WriteLine($"Extension was {Extension!.PackageFamilyName}"); Debug.WriteLine(e); } @@ -160,8 +158,8 @@ public async Task LoadTopLevelCommands() public override int GetHashCode() => _commandProvider.GetHashCode(); - private void CommandProvider_ItemsChanged(object sender, ItemsChangedEventArgs args) - { + private void CommandProvider_ItemsChanged(object sender, IItemsChangedEventArgs args) => + // We don't want to handle this ourselves - we want the // TopLevelCommandManager to know about this, so they can remove // our old commands from their own list. @@ -169,5 +167,4 @@ private void CommandProvider_ItemsChanged(object sender, ItemsChangedEventArgs a // In handling this, a call will be made to `LoadTopLevelCommands` to // retrieve the new items. this.CommandsChanged?.Invoke(this, args); - } } diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/BuiltInsCommandProvider.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/BuiltInsCommandProvider.cs index 5ae16bac31a3..24865ea18599 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/BuiltInsCommandProvider.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/BuiltInsCommandProvider.cs @@ -35,6 +35,6 @@ public BuiltInsCommandProvider() { Id = "Core"; DisplayName = "Built-in commands"; - Icon = new(Path.Combine(AppDomain.CurrentDomain.BaseDirectory.ToString(), "Assets\\StoreLogo.scale-200.png")); + Icon = new IconInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory.ToString(), "Assets\\StoreLogo.scale-200.png")); } } diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/LogMessagesPage.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/LogMessagesPage.cs index fbd90701c4df..44297f86fcd8 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/LogMessagesPage.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/LogMessagesPage.cs @@ -16,7 +16,7 @@ public LogMessagesPage() { Name = "View log"; Title = "Log"; - Icon = new("\uE8FD"); + Icon = new IconInfo("\uE8FD"); CommandPaletteHost.LogMessages.CollectionChanged += LogMessages_CollectionChanged; } diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs index 116fb83d1de5..2e1c1daef3c2 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs @@ -32,7 +32,7 @@ public partial class MainListPage : DynamicListPage, public MainListPage(IServiceProvider serviceProvider) { Name = "Command Palette"; - Icon = new(Path.Combine(AppDomain.CurrentDomain.BaseDirectory.ToString(), "Assets\\StoreLogo.scale-200.png")); + Icon = new IconInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory.ToString(), "Assets\\StoreLogo.scale-200.png")); _serviceProvider = serviceProvider; _tlcManager = _serviceProvider.GetService()!; diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/OpenSettingsCommand.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/OpenSettingsCommand.cs index 3f8135eb22e8..167b2f2193b0 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/OpenSettingsCommand.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/OpenSettingsCommand.cs @@ -14,7 +14,7 @@ public partial class OpenSettingsCommand : InvokableCommand public OpenSettingsCommand() { Name = "Open Settings"; - Icon = new("\uE713"); + Icon = new IconInfo("\uE713"); } public override ICommandResult Invoke() diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/QuitAction.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/QuitAction.cs index 3f9e89f79c8b..5a86284ac377 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/QuitAction.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/QuitAction.cs @@ -13,7 +13,7 @@ public partial class QuitCommand : InvokableCommand, IFallbackHandler { public QuitCommand() { - Icon = new("\uE711"); + Icon = new IconInfo("\uE711"); } public override ICommandResult Invoke() diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/ReloadExtensionsCommand.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/ReloadExtensionsCommand.cs index 6efc9c9bb336..145fd5c87301 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/ReloadExtensionsCommand.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/ReloadExtensionsCommand.cs @@ -13,7 +13,7 @@ public partial class ReloadExtensionsCommand : InvokableCommand { public ReloadExtensionsCommand() { - Icon = new("\uE72C"); // Refresh icon + Icon = new IconInfo("\uE72C"); // Refresh icon } public override ICommandResult Invoke() diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ContentMarkdownViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ContentMarkdownViewModel.cs index 84431c794705..7323ef87ef60 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ContentMarkdownViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ContentMarkdownViewModel.cs @@ -35,7 +35,7 @@ public override void InitializeProperties() model.PropChanged += Model_PropChanged; } - private void Model_PropChanged(object sender, PropChangedEventArgs args) + private void Model_PropChanged(object sender, IPropChangedEventArgs args) { try { diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ContentPageViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ContentPageViewModel.cs index fa43720343d1..1e48d324f707 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ContentPageViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ContentPageViewModel.cs @@ -38,7 +38,7 @@ public ContentPageViewModel(IContentPage model, TaskScheduler scheduler, Command } // TODO: Does this need to hop to a _different_ thread, so that we don't block the extension while we're fetching? - private void Model_ItemsChanged(object sender, ItemsChangedEventArgs args) => FetchContent(); + private void Model_ItemsChanged(object sender, IItemsChangedEventArgs args) => FetchContent(); //// Run on background thread, from InitializeAsync or Model_ItemsChanged private void FetchContent() diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ContentTreeViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ContentTreeViewModel.cs index ec3a44ff72be..3c0e93e7c872 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ContentTreeViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ContentTreeViewModel.cs @@ -47,9 +47,9 @@ public override void InitializeProperties() } // TODO: Does this need to hop to a _different_ thread, so that we don't block the extension while we're fetching? - private void Model_ItemsChanged(object sender, ItemsChangedEventArgs args) => FetchContent(); + private void Model_ItemsChanged(object sender, IItemsChangedEventArgs args) => FetchContent(); - private void Model_PropChanged(object sender, PropChangedEventArgs args) + private void Model_PropChanged(object sender, IPropChangedEventArgs args) { try { diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/IconDataViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/IconDataViewModel.cs index 35ffed85de23..e969fe5ffd8b 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/IconDataViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/IconDataViewModel.cs @@ -11,21 +11,21 @@ namespace Microsoft.CmdPal.UI.ViewModels; public partial class IconDataViewModel : ObservableObject { - private readonly ExtensionObject _model = new(null); + private readonly ExtensionObject _model = new(null); // If the extension previously gave us a Data, then died, the data will // throw if we actually try to read it, but the pointer itself won't be // null, so this is relatively safe. public bool HasIcon => !string.IsNullOrEmpty(Icon) || Data.Unsafe != null; - // Locally cached properties from IconData. + // Locally cached properties from IIconData. public string Icon { get; private set; } = string.Empty; // Streams are not trivially copy-able, so we can't copy the data locally // first. Hence why we're sticking this into an ExtensionObject public ExtensionObject Data { get; private set; } = new(null); - public IconDataViewModel(IconData? icon) + public IconDataViewModel(IIconData? icon) { _model = new(icon); } diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/IconInfoViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/IconInfoViewModel.cs index c5565f5ab3f2..8f794ee3d536 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/IconInfoViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/IconInfoViewModel.cs @@ -10,7 +10,7 @@ namespace Microsoft.CmdPal.UI.ViewModels; public partial class IconInfoViewModel : ObservableObject { - private readonly ExtensionObject _model = new(null); + private readonly ExtensionObject _model = new(null); // These are properties that are "observable" from the extension object // itself, in the sense that they get raised by PropChanged events from the @@ -26,7 +26,7 @@ public partial class IconInfoViewModel : ObservableObject public bool HasIcon(bool light) => IconForTheme(light).HasIcon; - public IconInfoViewModel(IconInfo? icon) + public IconInfoViewModel(IIconInfo? icon) { _model = new(icon); Light = new(null); diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ListViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ListViewModel.cs index 527d3648d2f3..47692b621dc5 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ListViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ListViewModel.cs @@ -50,7 +50,7 @@ public ListViewModel(IListPage model, TaskScheduler scheduler, CommandPaletteHos } // TODO: Does this need to hop to a _different_ thread, so that we don't block the extension while we're fetching? - private void Model_ItemsChanged(object sender, ItemsChangedEventArgs args) => FetchItems(); + private void Model_ItemsChanged(object sender, IItemsChangedEventArgs args) => FetchItems(); protected override void OnFilterUpdated(string filter) { diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/PageViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/PageViewModel.cs index ad10c3d7d47f..000f4535d5f2 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/PageViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/PageViewModel.cs @@ -75,10 +75,7 @@ public PageViewModel(IPage? model, TaskScheduler scheduler, CommandPaletteHost e UpdateHasStatusMessage(); } - private void StatusMessages_CollectionChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) - { - UpdateHasStatusMessage(); - } + private void StatusMessages_CollectionChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) => UpdateHasStatusMessage(); private void UpdateHasStatusMessage() { @@ -149,7 +146,7 @@ public override void InitializeProperties() page.PropChanged += Model_PropChanged; } - private void Model_PropChanged(object sender, PropChangedEventArgs args) + private void Model_PropChanged(object sender, IPropChangedEventArgs args) { try { diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ProgressViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ProgressViewModel.cs index 2947e5fa8214..0faf829a5710 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ProgressViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/ProgressViewModel.cs @@ -35,7 +35,7 @@ public override void InitializeProperties() model.PropChanged += Model_PropChanged; } - private void Model_PropChanged(object sender, PropChangedEventArgs args) + private void Model_PropChanged(object sender, IPropChangedEventArgs args) { try { diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/SettingsViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/SettingsViewModel.cs index 3f6e3ac0eff7..d3cdc8d8772f 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/SettingsViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/SettingsViewModel.cs @@ -4,6 +4,7 @@ using System.Collections.ObjectModel; using Microsoft.CmdPal.UI.ViewModels.Settings; +using Microsoft.CommandPalette.Extensions.Toolkit; using Microsoft.Extensions.DependencyInjection; namespace Microsoft.CmdPal.UI.ViewModels; @@ -81,7 +82,7 @@ public SettingsViewModel(SettingsModel settings, IServiceProvider serviceProvide _settings = settings; _serviceProvider = serviceProvider; - Icon = new(new("\uE713")); + Icon = new(new IconInfo("\uE713")); Icon.InitializeProperties(); IsInitialized = true; ModelIsLoading = false; diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/StatusMessageViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/StatusMessageViewModel.cs index fdc327792289..d5e63eddd029 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/StatusMessageViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/StatusMessageViewModel.cs @@ -50,7 +50,7 @@ public override void InitializeProperties() model.PropChanged += Model_PropChanged; } - private void Model_PropChanged(object sender, PropChangedEventArgs args) + private void Model_PropChanged(object sender, IPropChangedEventArgs args) { try { diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandItemWrapper.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandItemWrapper.cs index 8c7f4fcd5658..9661841cf79e 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandItemWrapper.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandItemWrapper.cs @@ -86,7 +86,7 @@ public TopLevelCommandItemWrapper( } } - private void Model_PropChanged(object sender, PropChangedEventArgs args) + private void Model_PropChanged(object sender, IPropChangedEventArgs args) { try { diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandManager.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandManager.cs index 00a194742281..90c2fb76b22d 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandManager.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandManager.cs @@ -92,7 +92,7 @@ await Task.Factory.StartNew( commandProvider.CommandsChanged += CommandProvider_CommandsChanged; } - private void CommandProvider_CommandsChanged(CommandProviderWrapper sender, ItemsChangedEventArgs args) + private void CommandProvider_CommandsChanged(CommandProviderWrapper sender, IItemsChangedEventArgs args) { // By all accounts, we're already on a background thread (the COM call // to handle the event shouldn't be on the main thread.). But just to @@ -108,7 +108,7 @@ private void CommandProvider_CommandsChanged(CommandProviderWrapper sender, Item /// The provider who's commands changed /// the ItemsChangedEvent the provider raised /// an awaitable task - private async Task UpdateCommandsForProvider(CommandProviderWrapper sender, ItemsChangedEventArgs args) + private async Task UpdateCommandsForProvider(CommandProviderWrapper sender, IItemsChangedEventArgs args) { // Work on a clone of the list, so that we can just do one atomic // update to the actual observable list at the end diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandWrapper.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandWrapper.cs index b8094e3556d0..5bac00905406 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandWrapper.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandWrapper.cs @@ -4,6 +4,7 @@ using Microsoft.CmdPal.UI.ViewModels.Models; using Microsoft.CommandPalette.Extensions; +using Microsoft.CommandPalette.Extensions.Toolkit; using Windows.Foundation; namespace Microsoft.CmdPal.UI.ViewModels; @@ -12,13 +13,13 @@ public partial class TopLevelCommandWrapper : ICommand { private readonly ExtensionObject _command; - public event TypedEventHandler? PropChanged; + public event TypedEventHandler? PropChanged; public string Name { get; private set; } = string.Empty; public string Id { get; private set; } = string.Empty; - public IconInfo Icon { get; private set; } = new(null); + public IIconInfo Icon { get; private set; } = new IconInfo(null); public ICommand Command => _command.Unsafe!; @@ -41,7 +42,7 @@ public void UnsafeInitializeProperties() model.PropChanged += this.PropChanged; } - private void Model_PropChanged(object sender, PropChangedEventArgs args) + private void Model_PropChanged(object sender, IPropChangedEventArgs args) { try { diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/App.xaml.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/App.xaml.cs index 874b50616e86..02bec2921180 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/App.xaml.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/App.xaml.cs @@ -15,10 +15,10 @@ using Microsoft.CmdPal.Ext.WindowsTerminal; using Microsoft.CmdPal.Ext.WindowWalker; using Microsoft.CmdPal.Ext.WinGet; -using Microsoft.CommandPalette.Extensions; using Microsoft.CmdPal.UI.ViewModels; using Microsoft.CmdPal.UI.ViewModels.BuiltinCommands; using Microsoft.CmdPal.UI.ViewModels.Models; +using Microsoft.CommandPalette.Extensions; using Microsoft.Extensions.DependencyInjection; using Microsoft.UI.Xaml; diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/Tag.xaml.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/Tag.xaml.cs index 81e4b474b918..cea57298a3da 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/Tag.xaml.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/Tag.xaml.cs @@ -2,9 +2,9 @@ // 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; using Microsoft.CmdPal.UI.Helpers; using Microsoft.CmdPal.UI.ViewModels; +using Microsoft.CommandPalette.Extensions; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media; @@ -29,10 +29,7 @@ public OptionalColor? ForegroundColor set => SetValue(ForegroundColorProperty, value); } - public bool HasIcon - { - get => Icon?.HasIcon(this.ActualTheme == ElementTheme.Light) ?? false; - } + public bool HasIcon => Icon?.HasIcon(this.ActualTheme == ElementTheme.Light) ?? false; public IconInfoViewModel? Icon { diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/ExtViews/IconCacheService.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/ExtViews/IconCacheService.cs index 9704898d5c22..d80647923fd1 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/ExtViews/IconCacheService.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/ExtViews/IconCacheService.cs @@ -21,7 +21,7 @@ public sealed class IconCacheService(DispatcherQueue dispatcherQueue) private async Task IconToSource(IconDataViewModel icon) { - // bodgy: apparently IconData, despite being a struct, doesn't get + // bodgy: apparently IIconData, despite being a struct, doesn't get // MarshalByValue'd into our process. What's even the point then? try { diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/MainWindow.xaml.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/MainWindow.xaml.cs index 6afe1352a806..0d02513ce445 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/MainWindow.xaml.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/MainWindow.xaml.cs @@ -47,7 +47,7 @@ public sealed partial class MainWindow : Window, #pragma warning restore SA1310 // Field names should not contain underscore // Notification Area ("Tray") icon data - private NOTIFYICONDATAW? _trayIconData; + private NOTIFYICONDATAW? _trayIIconData; private bool _createdIcon; private DestroyIconSafeHandle? _largeIcon; @@ -396,14 +396,14 @@ private LRESULT HotKeyPrc( private void AddNotificationIcon() { // We only need to build the tray data once. - if (_trayIconData == null) + if (_trayIIconData == null) { // We need to stash this handle, so it doesn't clean itself up. If // explorer restarts, we'll come back through here, and we don't // really need to re-load the icon in that case. We can just use // the handle from the first time. _largeIcon = GetAppIconHandle(); - _trayIconData = new NOTIFYICONDATAW() + _trayIIconData = new NOTIFYICONDATAW() { cbSize = (uint)Marshal.SizeOf(typeof(NOTIFYICONDATAW)), hWnd = _hwnd, @@ -415,7 +415,7 @@ private void AddNotificationIcon() }; } - var d = (NOTIFYICONDATAW)_trayIconData; + var d = (NOTIFYICONDATAW)_trayIIconData; // Add the notification icon if (PInvoke.Shell_NotifyIcon(NOTIFY_ICON_MESSAGE.NIM_ADD, in d)) @@ -426,9 +426,9 @@ private void AddNotificationIcon() private void RemoveNotificationIcon() { - if (_trayIconData != null && _createdIcon) + if (_trayIIconData != null && _createdIcon) { - var d = (NOTIFYICONDATAW)_trayIconData; + var d = (NOTIFYICONDATAW)_trayIIconData; if (PInvoke.Shell_NotifyIcon(NOTIFY_ICON_MESSAGE.NIM_DELETE, in d)) { _createdIcon = false; diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Pages/ShellPage.xaml.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/Pages/ShellPage.xaml.cs index a44119f5fd0b..4a0c6f96db0f 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Pages/ShellPage.xaml.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Pages/ShellPage.xaml.cs @@ -5,10 +5,10 @@ using System.ComponentModel; using CommunityToolkit.Mvvm.Messaging; using CommunityToolkit.WinUI; -using Microsoft.CommandPalette.Extensions; using Microsoft.CmdPal.UI.ViewModels; using Microsoft.CmdPal.UI.ViewModels.MainPage; using Microsoft.CmdPal.UI.ViewModels.Messages; +using Microsoft.CommandPalette.Extensions; using Microsoft.Extensions.DependencyInjection; using Microsoft.UI.Dispatching; using Microsoft.UI.Xaml.Media.Animation; diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/CopyTextCommand.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/CopyTextCommand.cs new file mode 100644 index 000000000000..29c09d2e6055 --- /dev/null +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/CopyTextCommand.cs @@ -0,0 +1,25 @@ +// 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. + +namespace Microsoft.CommandPalette.Extensions.Toolkit; + +public partial class CopyTextCommand : InvokableCommand +{ + public string Text { get; set; } + + public CommandResult Result { get; set; } = CommandResult.Dismiss(); + + public CopyTextCommand(string text) + { + Text = text; + Name = "Copy"; + Icon = new IconInfo("\uE8C8"); + } + + public override ICommandResult Invoke() + { + ClipboardHelper.SetText(Text); + return Result; + } +} diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/OpenUrlCommand.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/OpenUrlCommand.cs new file mode 100644 index 000000000000..7189472c6838 --- /dev/null +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/OpenUrlCommand.cs @@ -0,0 +1,25 @@ +// 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. + +namespace Microsoft.CommandPalette.Extensions.Toolkit; + +public sealed partial class OpenUrlCommand : InvokableCommand +{ + private readonly string _target; + + public CommandResult Result { get; set; } = CommandResult.KeepOpen(); + + public OpenUrlCommand(string target) + { + _target = target; + Name = "Open"; + Icon = new IconInfo("\uE8A7"); + } + + public override CommandResult Invoke() + { + ShellHelpers.OpenInShell(_target); + return Result; + } +} diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/BaseObservable.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/BaseObservable.cs index 30adc8a629da..92303397dcba 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/BaseObservable.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/BaseObservable.cs @@ -12,7 +12,7 @@ namespace Microsoft.CommandPalette.Extensions.Toolkit; // (also consider this for ItemsChanged in ListPage) public partial class BaseObservable : INotifyPropChanged { - public event TypedEventHandler? PropChanged; + public event TypedEventHandler? PropChanged; protected void OnPropertyChanged(string propertyName) { diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/Command.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/Command.cs index 253817494eb0..b5eedf7b674f 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/Command.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/Command.cs @@ -6,28 +6,31 @@ namespace Microsoft.CommandPalette.Extensions.Toolkit; public partial class Command : BaseObservable, ICommand { - private string _name = string.Empty; - private IconInfo _icon = new(string.Empty); - public string Name { - get => _name; + get; set { - _name = value; + field = value; OnPropertyChanged(nameof(Name)); } } += string.Empty; + public string Id { get; protected set; } = string.Empty; - public IconInfo Icon + public virtual IconInfo Icon { - get => _icon; + get; set { - _icon = value; + field = value; OnPropertyChanged(nameof(Icon)); } } + += new(); + + IIconInfo ICommand.Icon => Icon; } diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/CommandContextItem.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/CommandContextItem.cs index 09066ed049d1..3a811f2ff4bc 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/CommandContextItem.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/CommandContextItem.cs @@ -8,7 +8,7 @@ public partial class CommandContextItem : CommandItem, ICommandContextItem { public bool IsCritical { get; set; } - public KeyChord? RequestedShortcut { get; set; } + public KeyChord RequestedShortcut { get; set; } public CommandContextItem(ICommand command) : base(command) diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/CommandItem.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/CommandItem.cs index 9d5149f6c529..c21bfbce3dd3 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/CommandItem.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/CommandItem.cs @@ -6,43 +6,43 @@ namespace Microsoft.CommandPalette.Extensions.Toolkit; public partial class CommandItem : BaseObservable, ICommandItem { - private IconInfo? _icon; - private string _title = string.Empty; - private string _subtitle = string.Empty; private ICommand? _command; - private IContextItem[] _moreCommands = []; - public IconInfo? Icon + public IIconInfo? Icon { - get => _icon ?? _command?.Icon; + get => field; set { - _icon = value; + field = value; OnPropertyChanged(nameof(Icon)); } } public string Title { - get => !string.IsNullOrEmpty(this._title) ? _title : _command?.Name ?? string.Empty; + get => !string.IsNullOrEmpty(field) ? field : _command?.Name ?? string.Empty; set { - _title = value; + field = value; OnPropertyChanged(nameof(Title)); } } += string.Empty; + public string Subtitle { - get => _subtitle; + get; set { - _subtitle = value; + field = value; OnPropertyChanged(nameof(Subtitle)); } } += string.Empty; + public virtual ICommand? Command { get => _command; @@ -55,14 +55,16 @@ public virtual ICommand? Command public IContextItem[] MoreCommands { - get => _moreCommands; + get; set { - _moreCommands = value; + field = value; OnPropertyChanged(nameof(MoreCommands)); } } += []; + public CommandItem(ICommand command) { Command = command; @@ -74,7 +76,7 @@ public CommandItem(ICommandItem other) Command = other.Command; Title = other.Title; Subtitle = other.Subtitle; - Icon = other.Icon; + Icon = (IconInfo?)other.Icon; MoreCommands = other.MoreCommands; } } diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/CommandProvider.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/CommandProvider.cs index 648a785e47a8..d7f2b7919c03 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/CommandProvider.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/CommandProvider.cs @@ -8,42 +8,27 @@ namespace Microsoft.CommandPalette.Extensions.Toolkit; public abstract partial class CommandProvider : ICommandProvider { - private string _id = string.Empty; + public string Id { get; protected set; } = string.Empty; - private string _displayName = string.Empty; + public string DisplayName { get; protected set; } = string.Empty; - private IconInfo _icon = new(string.Empty); + public IconInfo Icon { get; protected set; } = new IconInfo(); - private ICommandSettings? _settings; - - public string Id { get => _id; protected set => _id = value; } - - public string DisplayName { get => _displayName; protected set => _displayName = value; } - - public IconInfo Icon { get => _icon; protected set => _icon = value; } - - public event TypedEventHandler? ItemsChanged; + public event TypedEventHandler? ItemsChanged; public abstract ICommandItem[] TopLevelCommands(); - public virtual IFallbackCommandItem[]? FallbackCommands() - { - return null; - } + public virtual IFallbackCommandItem[]? FallbackCommands() => null; - public virtual ICommand? GetCommand(string id) - { - return null; - } + public virtual ICommand? GetCommand(string id) => null; - public ICommandSettings? Settings { get => _settings; protected set => _settings = value; } + public ICommandSettings? Settings { get; protected set; } public bool Frozen { get; protected set; } = true; - public virtual void InitializeWithHost(IExtensionHost host) - { - ExtensionHost.Initialize(host); - } + IIconInfo ICommandProvider.Icon => Icon; + + public virtual void InitializeWithHost(IExtensionHost host) => ExtensionHost.Initialize(host); #pragma warning disable CA1816 // Dispose methods should call SuppressFinalize public void Dispose() diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/ContentPage.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/ContentPage.cs index 8066e3b14aa3..11cf33a86c07 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/ContentPage.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/ContentPage.cs @@ -8,7 +8,7 @@ namespace Microsoft.CommandPalette.Extensions.Toolkit; public abstract partial class ContentPage : Page, IContentPage { - public event TypedEventHandler? ItemsChanged; + public event TypedEventHandler? ItemsChanged; public IDetails? Details { diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/CopyTextCommand.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/CopyTextCommand.cs index 4eb3f1b18570..29c09d2e6055 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/CopyTextCommand.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/CopyTextCommand.cs @@ -14,7 +14,7 @@ public CopyTextCommand(string text) { Text = text; Name = "Copy"; - Icon = new("\uE8C8"); + Icon = new IconInfo("\uE8C8"); } public override ICommandResult Invoke() diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/Details.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/Details.cs index 43acf33676d1..80066140e71c 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/Details.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/Details.cs @@ -6,48 +6,53 @@ namespace Microsoft.CommandPalette.Extensions.Toolkit; public partial class Details : BaseObservable, IDetails { - private IconInfo _heroImage = new(string.Empty); - private string _title = string.Empty; - private string _body = string.Empty; - private IDetailsElement[] _metadata = []; - public IconInfo HeroImage { - get => _heroImage; + get => field; set { - _heroImage = value; + field = value; OnPropertyChanged(nameof(HeroImage)); } } += new(); + public string Title { - get => _title; + get; set { - _title = value; + field = value; OnPropertyChanged(nameof(Title)); } } += string.Empty; + public string Body { - get => _body; + get; set { - _body = value; + field = value; OnPropertyChanged(nameof(Body)); } } += string.Empty; + public IDetailsElement[] Metadata { - get => _metadata; + get; set { - _metadata = value; + field = value; OnPropertyChanged(nameof(Metadata)); } } + += []; + + IIconInfo IDetails.HeroImage => HeroImage; } diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/Filter.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/Filter.cs index 469fb34f2f61..c3c32a91ab1a 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/Filter.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/Filter.cs @@ -6,7 +6,7 @@ namespace Microsoft.CommandPalette.Extensions.Toolkit; public partial class Filter : IFilter { - public IconInfo Icon => throw new NotImplementedException(); + public IIconInfo Icon => throw new NotImplementedException(); public string Id => throw new NotImplementedException(); diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/GlobalSuppressions.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/GlobalSuppressions.cs index ff07ace73e3f..9f29e237141e 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/GlobalSuppressions.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/GlobalSuppressions.cs @@ -4,5 +4,5 @@ using System.Diagnostics.CodeAnalysis; -[assembly: SuppressMessage("Usage", "CsWinRT1028:Class is not marked partial", Justification = "Type is not passed across the WinRT ABI", Scope = "type", Target = "~T:WinRT._EventSource_global__Windows_Foundation_TypedEventHandler_object__global__Microsoft_CommandPalette_Extensions_PropChangedEventArgs_.EventState")] -[assembly: SuppressMessage("Usage", "CsWinRT1028:Class is not marked partial", Justification = "Type is not passed across the WinRT ABI", Scope = "type", Target = "~T:WinRT._EventSource_global__Windows_Foundation_TypedEventHandler_object__global__Microsoft_CommandPalette_Extensions_ItemsChangedEventArgs_.EventState")] +[assembly: SuppressMessage("Usage", "CsWinRT1028:Class is not marked partial", Justification = "Type is not passed across the WinRT ABI", Scope = "type", Target = "~T:WinRT._EventSource_global__Windows_Foundation_TypedEventHandler_object__global__Microsoft_CommandPalette_Extensions_IPropChangedEventArgs_.EventState")] +[assembly: SuppressMessage("Usage", "CsWinRT1028:Class is not marked partial", Justification = "Type is not passed across the WinRT ABI", Scope = "type", Target = "~T:WinRT._EventSource_global__Windows_Foundation_TypedEventHandler_object__global__Microsoft_CommandPalette_Extensions_IItemsChangedEventArgs_.EventState")] diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/IconData.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/IconData.cs new file mode 100644 index 000000000000..b36f7242aead --- /dev/null +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/IconData.cs @@ -0,0 +1,29 @@ +// 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 Windows.Storage.Streams; + +namespace Microsoft.CommandPalette.Extensions.Toolkit; + +public partial class IconData : IIconData +{ + public IRandomAccessStreamReference? Data { get; set; } + + public string? Icon { get; set; } = string.Empty; + + public IconData(string? icon) + { + Icon = icon; + } + + public IconData(IRandomAccessStreamReference data) + { + Data = data; + } + + internal IconData() + : this(string.Empty) + { + } +} diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/IconInfo.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/IconInfo.cs new file mode 100644 index 000000000000..25f73629bd64 --- /dev/null +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/IconInfo.cs @@ -0,0 +1,32 @@ +// 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. + +namespace Microsoft.CommandPalette.Extensions.Toolkit; + +public partial class IconInfo : IIconInfo +{ + public IconData Dark { get; set; } = new(); + + public IconData Light { get; set; } = new(); + + IIconData IIconInfo.Dark => Dark; + + IIconData IIconInfo.Light => Light; + + public IconInfo(string? icon) + { + Dark = Light = new(icon); + } + + public IconInfo(IconData light, IconData dark) + { + Light = light; + Dark = dark; + } + + internal IconInfo() + : this(string.Empty) + { + } +} diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/ItemsChangedEventArgs.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/ItemsChangedEventArgs.cs new file mode 100644 index 000000000000..e859dd12cf7d --- /dev/null +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/ItemsChangedEventArgs.cs @@ -0,0 +1,17 @@ +// 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 Windows.Foundation; + +namespace Microsoft.CommandPalette.Extensions.Toolkit; + +public partial class ItemsChangedEventArgs : IItemsChangedEventArgs +{ + public int TotalItems { get; protected set; } + + public ItemsChangedEventArgs(int totalItems = -1) + { + TotalItems = totalItems; + } +} diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/KeyChordHelpers.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/KeyChordHelpers.cs new file mode 100644 index 000000000000..6c6a0ac5c51a --- /dev/null +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/KeyChordHelpers.cs @@ -0,0 +1,21 @@ +// 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 Windows.Foundation; +using Windows.System; + +namespace Microsoft.CommandPalette.Extensions.Toolkit; + +public partial class KeyChordHelpers +{ + public static KeyChord FromModifiers(bool ctrl, bool alt, bool shift, bool win, int vkey, int scanCode) + { + var modifiers = (ctrl ? VirtualKeyModifiers.Control : VirtualKeyModifiers.None) + | (alt ? VirtualKeyModifiers.Menu : VirtualKeyModifiers.None) + | (shift ? VirtualKeyModifiers.Shift : VirtualKeyModifiers.None) + | (win ? VirtualKeyModifiers.Windows : VirtualKeyModifiers.None) + ; + return new(modifiers, vkey, scanCode); + } +} diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/ListPage.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/ListPage.cs index 346fd073d525..3211f3dae55d 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/ListPage.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/ListPage.cs @@ -16,7 +16,7 @@ public partial class ListPage : Page, IListPage private IGridProperties? _gridProperties; private ICommandItem? _emptyContent; - public event TypedEventHandler? ItemsChanged; + public event TypedEventHandler? ItemsChanged; public string PlaceholderText { diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/OpenUrlCommand.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/OpenUrlCommand.cs index b6bfb3b725d8..7189472c6838 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/OpenUrlCommand.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/OpenUrlCommand.cs @@ -14,7 +14,7 @@ public OpenUrlCommand(string target) { _target = target; Name = "Open"; - Icon = new("\uE8A7"); + Icon = new IconInfo("\uE8A7"); } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/PropChangedEventArgs.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/PropChangedEventArgs.cs new file mode 100644 index 000000000000..aab02590f345 --- /dev/null +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/PropChangedEventArgs.cs @@ -0,0 +1,17 @@ +// 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 Windows.Foundation; + +namespace Microsoft.CommandPalette.Extensions.Toolkit; + +public partial class PropChangedEventArgs : IPropChangedEventArgs +{ + public string PropertyName { get; private set; } + + public PropChangedEventArgs(string propertyName) + { + PropertyName = propertyName; + } +} diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/Tag.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/Tag.cs index 4bfcd946db0c..a994f98fc632 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/Tag.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/Tag.cs @@ -64,6 +64,8 @@ public string ToolTip = string.Empty; + IIconInfo ITag.Icon => Icon; + public Tag() { } diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/TreeContent.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/TreeContent.cs index 7221732163e5..ff68a09b484f 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/TreeContent.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/TreeContent.cs @@ -20,7 +20,7 @@ public virtual IContent? RootContent } } - public event TypedEventHandler? ItemsChanged; + public event TypedEventHandler? ItemsChanged; public virtual IContent[] GetChildren() => Children; diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions/Microsoft.CommandPalette.Extensions.idl b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions/Microsoft.CommandPalette.Extensions.idl index 889e3143b56a..883497ac11cf 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions/Microsoft.CommandPalette.Extensions.idl +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions/Microsoft.CommandPalette.Extensions.idl @@ -15,31 +15,31 @@ namespace Microsoft.CommandPalette.Extensions }; [contract(Microsoft.CommandPalette.Extensions.ExtensionsContract, 1)] - runtimeclass IconData { - IconData(String iconString); - static IconData FromStream(Windows.Storage.Streams.IRandomAccessStreamReference stream); + interface IIconData { + // IIconData(String iconString); + // static IIconData FromStream(Windows.Storage.Streams.IRandomAccessStreamReference stream); String Icon { get; }; Windows.Storage.Streams.IRandomAccessStreamReference Data { get; }; }; [contract(Microsoft.CommandPalette.Extensions.ExtensionsContract, 1)] - runtimeclass IconInfo { - IconInfo(String iconString); - IconInfo(IconData lightIcon, IconData darkIcon); + interface IIconInfo { + // IIconInfo(String iconString); + // IIconInfo(IconData lightIcon, IIconData darkIcon); - IconData Light { get; }; - IconData Dark { get; }; + IIconData Light { get; }; + IIconData Dark { get; }; }; [contract(Microsoft.CommandPalette.Extensions.ExtensionsContract, 1)] - runtimeclass KeyChord + struct KeyChord { - KeyChord(); - KeyChord(Windows.System.VirtualKeyModifiers modifiers, Int32 vkey, Int32 scanCode); - KeyChord(Boolean ctrl, Boolean alt, Boolean shift, Boolean win, Int32 vkey, Int32 scanCode); - UInt64 Hash(); - Boolean Equals(KeyChord other); + // KeyChord(); + // KeyChord(Windows.System.VirtualKeyModifiers modifiers, Int32 vkey, Int32 scanCode); + // KeyChord(Boolean ctrl, Boolean alt, Boolean shift, Boolean win, Int32 vkey, Int32 scanCode); + // UInt64 Hash(); + // Boolean Equals(KeyChord other); Windows.System.VirtualKeyModifiers Modifiers; Int32 Vkey; Int32 ScanCode; @@ -47,23 +47,23 @@ namespace Microsoft.CommandPalette.Extensions [contract(Microsoft.CommandPalette.Extensions.ExtensionsContract, 1)] interface INotifyPropChanged { - event Windows.Foundation.TypedEventHandler PropChanged; + event Windows.Foundation.TypedEventHandler PropChanged; }; [contract(Microsoft.CommandPalette.Extensions.ExtensionsContract, 1)] - runtimeclass PropChangedEventArgs { - PropChangedEventArgs(String propertyName); + interface IPropChangedEventArgs { + // PropChangedEventArgs(String propertyName); String PropertyName { get; }; }; [contract(Microsoft.CommandPalette.Extensions.ExtensionsContract, 1)] interface INotifyItemsChanged { - event Windows.Foundation.TypedEventHandler ItemsChanged; + event Windows.Foundation.TypedEventHandler ItemsChanged; }; [contract(Microsoft.CommandPalette.Extensions.ExtensionsContract, 1)] - runtimeclass ItemsChangedEventArgs { - ItemsChangedEventArgs(Int32 totalItems); + interface IItemsChangedEventArgs { + // ItemsChangedEventArgs(Int32 totalItems); Int32 TotalItems { get; }; }; @@ -71,7 +71,7 @@ namespace Microsoft.CommandPalette.Extensions interface ICommand requires INotifyPropChanged{ String Name{ get; }; String Id{ get; }; - IconInfo Icon{ get; }; + IIconInfo Icon{ get; }; } enum CommandResultKind { @@ -138,7 +138,7 @@ namespace Microsoft.CommandPalette.Extensions interface IFilter requires IFilterItem { String Id { get; }; String Name { get; }; - IconInfo Icon { get; }; + IIconInfo Icon { get; }; } [contract(Microsoft.CommandPalette.Extensions.ExtensionsContract, 1)] @@ -163,7 +163,7 @@ namespace Microsoft.CommandPalette.Extensions [contract(Microsoft.CommandPalette.Extensions.ExtensionsContract, 1)] interface ITag { - IconInfo Icon { get; }; + IIconInfo Icon { get; }; String Text { get; }; OptionalColor Foreground { get; }; OptionalColor Background { get; }; @@ -180,7 +180,7 @@ namespace Microsoft.CommandPalette.Extensions } [contract(Microsoft.CommandPalette.Extensions.ExtensionsContract, 1)] interface IDetails { - IconInfo HeroImage { get; }; + IIconInfo HeroImage { get; }; String Title { get; }; String Body { get; }; IDetailsElement[] Metadata { get; }; @@ -261,7 +261,7 @@ namespace Microsoft.CommandPalette.Extensions interface ICommandItem requires INotifyPropChanged { ICommand Command{ get; }; IContextItem[] MoreCommands{ get; }; - IconInfo Icon{ get; }; + IIconInfo Icon{ get; }; String Title{ get; }; String Subtitle{ get; }; } @@ -381,7 +381,7 @@ namespace Microsoft.CommandPalette.Extensions { String Id { get; }; String DisplayName { get; }; - IconInfo Icon { get; }; + IIconInfo Icon { get; }; ICommandSettings Settings { get; }; Boolean Frozen { get; }; diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions/Microsoft.CommandPalette.Extensions.vcxproj b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions/Microsoft.CommandPalette.Extensions.vcxproj index f156dc82ee3c..2cea03b7b03c 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions/Microsoft.CommandPalette.Extensions.vcxproj +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions/Microsoft.CommandPalette.Extensions.vcxproj @@ -141,20 +141,21 @@ - - - - + + + + - + + Create - - - - + + + + diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions/winrt_module.cpp b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions/winrt_module.cpp new file mode 100644 index 000000000000..73c475a1af90 --- /dev/null +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions/winrt_module.cpp @@ -0,0 +1,50 @@ +// WARNING: Please don't edit this file. It was generated by C++/WinRT v2.0.240111.5 + +#include "pch.h" +#include "winrt/base.h" + +bool __stdcall winrt_can_unload_now() noexcept +{ + if (winrt::get_module_lock()) + { + return false; + } + + winrt::clear_factory_cache(); + return true; +} + +void* __stdcall winrt_get_activation_factory([[maybe_unused]] std::wstring_view const& name) +{ + return nullptr; +} + +int32_t __stdcall WINRT_CanUnloadNow() noexcept +{ +#ifdef _WRL_MODULE_H_ + if (!::Microsoft::WRL::Module<::Microsoft::WRL::InProc>::GetModule().Terminate()) + { + return 1; + } +#endif + + return winrt_can_unload_now() ? 0 : 1; +} + +int32_t __stdcall WINRT_GetActivationFactory(void* classId, void** factory) noexcept try +{ + std::wstring_view const name{ *reinterpret_cast(&classId) }; + *factory = winrt_get_activation_factory(name); + + if (*factory) + { + return 0; + } + +#ifdef _WRL_MODULE_H_ + return ::Microsoft::WRL::Module<::Microsoft::WRL::InProc>::GetModule().GetActivationFactory(static_cast(classId), reinterpret_cast<::IActivationFactory**>(factory)); +#else + return winrt::hresult_class_not_available(name).to_abi(); +#endif +} +catch (...) { return winrt::to_hresult(); } diff --git a/src/modules/cmdpal/exts/MediaControlsExtension/PrevNextTrackAction.cs b/src/modules/cmdpal/exts/MediaControlsExtension/PrevNextTrackAction.cs index ca704cabf150..cdb9f0c41f6e 100644 --- a/src/modules/cmdpal/exts/MediaControlsExtension/PrevNextTrackAction.cs +++ b/src/modules/cmdpal/exts/MediaControlsExtension/PrevNextTrackAction.cs @@ -21,12 +21,12 @@ public PrevNextTrackAction(bool previous, GlobalSystemMediaTransportControlsSess if (previous) { Name = "Previous track"; - Icon = new("\ue892"); + Icon = new IconInfo("\ue892"); } else { Name = "Next track"; - Icon = new("\ue893"); + Icon = new IconInfo("\ue893"); } } diff --git a/src/modules/cmdpal/exts/MediaControlsExtension/PrevNextTrackCommand.cs b/src/modules/cmdpal/exts/MediaControlsExtension/PrevNextTrackCommand.cs index 45b1a56b2443..016f38458924 100644 --- a/src/modules/cmdpal/exts/MediaControlsExtension/PrevNextTrackCommand.cs +++ b/src/modules/cmdpal/exts/MediaControlsExtension/PrevNextTrackCommand.cs @@ -21,12 +21,12 @@ public PrevNextTrackCommand(bool previous, GlobalSystemMediaTransportControlsSes if (previous) { Name = "Previous track"; - Icon = new("\ue892"); + Icon = new IconInfo("\ue892"); } else { Name = "Next track"; - Icon = new("\ue893"); + Icon = new IconInfo("\ue893"); } } diff --git a/src/modules/cmdpal/exts/MediaControlsExtension/TogglePlayMediaAction.cs b/src/modules/cmdpal/exts/MediaControlsExtension/TogglePlayMediaAction.cs index ab8787f82fd9..833307794ae1 100644 --- a/src/modules/cmdpal/exts/MediaControlsExtension/TogglePlayMediaAction.cs +++ b/src/modules/cmdpal/exts/MediaControlsExtension/TogglePlayMediaAction.cs @@ -14,7 +14,7 @@ public sealed partial class TogglePlayMediaAction : InvokableCommand public TogglePlayMediaAction() { Name = "No media playing"; - Icon = new(string.Empty); + Icon = new IconInfo(string.Empty); } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/exts/MediaControlsExtension/TogglePlayMediaCommand.cs b/src/modules/cmdpal/exts/MediaControlsExtension/TogglePlayMediaCommand.cs index dc6bc0971120..4b1f5b436044 100644 --- a/src/modules/cmdpal/exts/MediaControlsExtension/TogglePlayMediaCommand.cs +++ b/src/modules/cmdpal/exts/MediaControlsExtension/TogglePlayMediaCommand.cs @@ -14,7 +14,7 @@ public sealed partial class TogglePlayMediaCommand : InvokableCommand public TogglePlayMediaCommand() { Name = "No media playing"; - Icon = new(string.Empty); + Icon = new IconInfo(string.Empty); } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Apps/AppAction.cs b/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Apps/AppAction.cs index 185791ff6959..b71bada5901f 100644 --- a/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Apps/AppAction.cs +++ b/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Apps/AppAction.cs @@ -17,7 +17,7 @@ internal AppAction(AppItem app) _app = app; Name = "Run"; - Icon = new(_app.IcoPath); + Icon = new IconInfo(_app.IcoPath); } internal static async Task StartApp(string aumid) diff --git a/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Apps/AppCommand.cs b/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Apps/AppCommand.cs index 7dcde3342d68..d228b04aaa49 100644 --- a/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Apps/AppCommand.cs +++ b/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Apps/AppCommand.cs @@ -17,7 +17,7 @@ internal AppCommand(AppItem app) _app = app; Name = "Run"; - Icon = new(_app.IcoPath); + Icon = new IconInfo(_app.IcoPath); } internal static async Task StartApp(string aumid) diff --git a/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Bookmark/UrlCommand.cs b/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Bookmark/UrlCommand.cs index 2329428b7483..a042df493f2c 100644 --- a/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Bookmark/UrlCommand.cs +++ b/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Bookmark/UrlCommand.cs @@ -21,7 +21,7 @@ public partial class UrlCommand : InvokableCommand public UrlCommand(string name, string url, string type) { _url = url; - Icon = new(IconFromUrl(_url, type)); + Icon = new IconInfo(IconFromUrl(_url, type)); Name = name; Type = type; Url = url; diff --git a/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Calc/CalculatorCopyCommand.cs b/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Calc/CalculatorCopyCommand.cs index 0bc40a7c7074..b52898671a95 100644 --- a/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Calc/CalculatorCopyCommand.cs +++ b/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Calc/CalculatorCopyCommand.cs @@ -15,7 +15,7 @@ public partial class CalculatorCopyCommand : InvokableCommand public CalculatorCopyCommand() { - Icon = new("\ue8ef"); + Icon = new IconInfo("\ue8ef"); } public override ICommandResult Invoke() diff --git a/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Shell/FallbackExecuteItem.cs b/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Shell/FallbackExecuteItem.cs index 15253d57ad53..d2fce013bd9a 100644 --- a/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Shell/FallbackExecuteItem.cs +++ b/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.Shell/FallbackExecuteItem.cs @@ -19,7 +19,7 @@ public FallbackExecuteItem(SettingsManager settings) Title = string.Empty; _executeItem.Name = string.Empty; Subtitle = Properties.Resources.generic_run_command; - Icon = new("\uE756"); + Icon = new IconInfo("\uE756"); } public override void UpdateQuery(string query) diff --git a/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.WebSearch/Commands/SearchWebCommand.cs b/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.WebSearch/Commands/SearchWebCommand.cs index 59c592b7d1b1..559c26d80e3b 100644 --- a/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.WebSearch/Commands/SearchWebCommand.cs +++ b/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.WebSearch/Commands/SearchWebCommand.cs @@ -21,7 +21,7 @@ internal SearchWebCommand(string arguments, SettingsManager settingsManager) { Arguments = arguments; BrowserInfo.UpdateIfTimePassed(); - Icon = new(BrowserInfo.IconPath); + Icon = new IconInfo(BrowserInfo.IconPath); Name = Properties.Resources.open_in_default_browser; _settingsManager = settingsManager; } diff --git a/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.WebSearch/FallbackExecuteSearchItem.cs b/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.WebSearch/FallbackExecuteSearchItem.cs index 7ea80336609c..a8d560079730 100644 --- a/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.WebSearch/FallbackExecuteSearchItem.cs +++ b/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.WebSearch/FallbackExecuteSearchItem.cs @@ -22,7 +22,7 @@ public FallbackExecuteSearchItem(SettingsManager settings) Title = string.Empty; _executeItem.Name = string.Empty; Subtitle = string.Format(CultureInfo.CurrentCulture, PluginOpen, BrowserInfo.Name ?? BrowserInfo.MSEdgeName); - Icon = new("\uF6FA"); // WebSearch icon + Icon = new IconInfo("\uF6FA"); // WebSearch icon } public override void UpdateQuery(string query) diff --git a/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.WinGet/Pages/InstallPackageListItem.cs b/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.WinGet/Pages/InstallPackageListItem.cs index b062e476ee52..b4ccf305ed02 100644 --- a/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.WinGet/Pages/InstallPackageListItem.cs +++ b/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.WinGet/Pages/InstallPackageListItem.cs @@ -40,7 +40,7 @@ public InstallPackageListItem(CatalogPackage package) {description} """; - IconInfo heroIcon = new(string.Empty); + IconInfo heroIcon = new IconInfo(string.Empty); var icons = metadata.Icons; if (icons.Count > 0) { @@ -167,7 +167,7 @@ private void InstallStateChangedHandler(object? sender, InstallPackageCommand e) Debug.WriteLine($"RefreshPackageCatalogAsync isn't available"); e.FakeChangeStatus(); Command = e; - Icon = Command.Icon; + Icon = (IconInfo?)Command.Icon; return; } diff --git a/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.WinGet/WinGetExtensionCommandsProvider.cs b/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.WinGet/WinGetExtensionCommandsProvider.cs index 90bee7c3e65f..8f2978c85f11 100644 --- a/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.WinGet/WinGetExtensionCommandsProvider.cs +++ b/src/modules/cmdpal/exts/Microsoft.CmdPal.Ext.WinGet/WinGetExtensionCommandsProvider.cs @@ -34,7 +34,7 @@ public WinGetExtensionCommandsProvider() new OpenUrlCommand("ms-windows-store://assoc/?Tags=AppExtension-com.microsoft.windows.commandpalette")) { Title = "Search for extensions on the Store", - Icon = new(Path.Combine(AppDomain.CurrentDomain.BaseDirectory.ToString(), "Assets\\ms-store.png")), + Icon = new IconInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory.ToString(), "Assets\\ms-store.png")), }, ]; diff --git a/src/modules/cmdpal/exts/SamplePagesExtension/Pages/SampleCommentsPage.cs b/src/modules/cmdpal/exts/SamplePagesExtension/Pages/SampleCommentsPage.cs index c246ce45cc44..36b82600c4ab 100644 --- a/src/modules/cmdpal/exts/SamplePagesExtension/Pages/SampleCommentsPage.cs +++ b/src/modules/cmdpal/exts/SamplePagesExtension/Pages/SampleCommentsPage.cs @@ -20,7 +20,7 @@ internal sealed partial class SampleCommentsPage : ContentPage public SampleCommentsPage() { Name = "View Posts"; - Icon = new("\uE90A"); // Comment + Icon = new IconInfo("\uE90A"); // Comment myContentTree = new() { diff --git a/src/modules/cmdpal/exts/SamplePagesExtension/Pages/SampleMarkdownDetails.cs b/src/modules/cmdpal/exts/SamplePagesExtension/Pages/SampleMarkdownDetails.cs index 974128c33d57..d56cf81ad4c1 100644 --- a/src/modules/cmdpal/exts/SamplePagesExtension/Pages/SampleMarkdownDetails.cs +++ b/src/modules/cmdpal/exts/SamplePagesExtension/Pages/SampleMarkdownDetails.cs @@ -10,7 +10,7 @@ internal sealed partial class SampleMarkdownDetails : MarkdownPage { public SampleMarkdownDetails() { - Icon = new(string.Empty); + Icon = new IconInfo(string.Empty); Name = "Markdown with Details"; Details = new Details() { diff --git a/src/modules/cmdpal/exts/SamplePagesExtension/Pages/SampleMarkdownManyBodies.cs b/src/modules/cmdpal/exts/SamplePagesExtension/Pages/SampleMarkdownManyBodies.cs index 815e88a24100..08a412397f97 100644 --- a/src/modules/cmdpal/exts/SamplePagesExtension/Pages/SampleMarkdownManyBodies.cs +++ b/src/modules/cmdpal/exts/SamplePagesExtension/Pages/SampleMarkdownManyBodies.cs @@ -10,7 +10,7 @@ internal sealed partial class SampleMarkdownManyBodies : MarkdownPage { public SampleMarkdownManyBodies() { - Icon = new(string.Empty); + Icon = new IconInfo(string.Empty); Name = "Markdown with many bodies"; } diff --git a/src/modules/cmdpal/exts/YouTubeExtension/Commands/GetVideoInfoCommand.cs b/src/modules/cmdpal/exts/YouTubeExtension/Commands/GetVideoInfoCommand.cs index 2ce1785ae19d..1dfc10e41194 100644 --- a/src/modules/cmdpal/exts/YouTubeExtension/Commands/GetVideoInfoCommand.cs +++ b/src/modules/cmdpal/exts/YouTubeExtension/Commands/GetVideoInfoCommand.cs @@ -15,7 +15,7 @@ internal GetVideoInfoCommand(YouTubeVideo video) { this._video = video; this.Name = "See more information"; - this.Icon = new("\uE946"); + this.Icon = new IconInfo("\uE946"); } public override CommandResult Invoke() => CommandResult.KeepOpen(); diff --git a/src/modules/cmdpal/exts/YouTubeExtension/Commands/OpenChannelLinkCommand.cs b/src/modules/cmdpal/exts/YouTubeExtension/Commands/OpenChannelLinkCommand.cs index 4c04aafb70ca..b4ddcb0410f9 100644 --- a/src/modules/cmdpal/exts/YouTubeExtension/Commands/OpenChannelLinkCommand.cs +++ b/src/modules/cmdpal/exts/YouTubeExtension/Commands/OpenChannelLinkCommand.cs @@ -15,7 +15,7 @@ internal OpenChannelLinkCommand(string url) { this._channelurl = url; this.Name = "Open channel"; - this.Icon = new("\uF131"); + this.Icon = new IconInfo("\uF131"); } public override CommandResult Invoke() diff --git a/src/modules/cmdpal/exts/YouTubeExtension/Commands/OpenVideoLinkCommand.cs b/src/modules/cmdpal/exts/YouTubeExtension/Commands/OpenVideoLinkCommand.cs index b918da3b909e..0fc1672eafdf 100644 --- a/src/modules/cmdpal/exts/YouTubeExtension/Commands/OpenVideoLinkCommand.cs +++ b/src/modules/cmdpal/exts/YouTubeExtension/Commands/OpenVideoLinkCommand.cs @@ -15,7 +15,7 @@ internal OpenVideoLinkCommand(string url) { this._videourl = url; this.Name = "Open video"; - this.Icon = new("\uE714"); + this.Icon = new IconInfo("\uE714"); } public override CommandResult Invoke()