diff --git a/src/modules/cmdpal/ext/SamplePagesExtension/Pages/SampleListPage.cs b/src/modules/cmdpal/ext/SamplePagesExtension/Pages/SampleListPage.cs index c116ffd38b..a10550538e 100644 --- a/src/modules/cmdpal/ext/SamplePagesExtension/Pages/SampleListPage.cs +++ b/src/modules/cmdpal/ext/SamplePagesExtension/Pages/SampleListPage.cs @@ -229,42 +229,4 @@ internal sealed partial class SampleListPage : ListPage { "hmm?", null }, }; } - - /// - /// Represents an icon that is a font glyph. - /// This is used for icons that are defined by a specific font face, - /// such as Wingdings. - /// - /// Note that Command Palette will default to using the Segoe Fluent Icons, - /// Segoe MDL2 Assets font for glyphs in the Segoe UI Symbol range, or Segoe - /// UI for any other glyphs. This class is only needed if you want a non-Segoe - /// font icon. - /// - /// WHY ISN'T THIS IN THE TOOLKIT: I have NO idea why, but if you put this - /// in the toolkit, and not in your extension code, we 100% fail to cast - /// the `Dictionary` to an IDictionary. The error was in - /// `IExtendedAttributesProvider:Do_Abi_GetProperties_0` - /// - internal sealed partial class FontIconData : IconData, IExtendedAttributesProvider - { - private string FontFamily { get; set; } - - // LOAD-BEARING: Use a Windows.Foundation.Collections.ValueSet as the - // backing store for Properties. A regular `Dictionary` - // will not work across the ABI - private readonly Windows.Foundation.Collections.ValueSet _properties; - - public IDictionary GetProperties() => _properties; - - public FontIconData(string glyph, string fontFamily) - : base(glyph) - { - FontFamily = fontFamily; - - _properties = new Windows.Foundation.Collections.ValueSet() - { - { "FontFamily", FontFamily }, - }; - } - } } diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/FontIconData.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/FontIconData.cs new file mode 100644 index 0000000000..7e12d38d0c --- /dev/null +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/FontIconData.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. +using Windows.Foundation.Collections; + +namespace Microsoft.CommandPalette.Extensions.Toolkit; + +/// +/// Represents an icon that is a font glyph. +/// This is used for icons that are defined by a specific font face, +/// such as Wingdings. +/// +/// Note that Command Palette will default to using the Segoe Fluent Icons, +/// Segoe MDL2 Assets font for glyphs in the Segoe UI Symbol range, or Segoe +/// UI for any other glyphs. This class is only needed if you want a non-Segoe +/// font icon. +/// +public partial class FontIconData : IconData, IExtendedAttributesProvider +{ + public string FontFamily { get; set; } + + public FontIconData(string glyph, string fontFamily) + : base(glyph) + { + FontFamily = fontFamily; + } + + public IDictionary? GetProperties() => new ValueSet() + { + { "FontFamily", FontFamily }, + }; +} diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/IconData.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/IconData.cs index b36f7242ae..35fdf7b8e7 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/IconData.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/IconData.cs @@ -2,6 +2,7 @@ // 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.Diagnostics.CodeAnalysis; using Windows.Storage.Streams; namespace Microsoft.CommandPalette.Extensions.Toolkit;