mirror of
https://github.com/microsoft/PowerToys
synced 2025-08-30 05:57:42 +00:00
ValueSet it is
This commit is contained in:
parent
eef0da2d22
commit
2fee0aef2a
@ -126,10 +126,6 @@ public partial class CommandViewModel : ExtensionObjectViewModel
|
|||||||
var iconInfo = model.Icon;
|
var iconInfo = model.Icon;
|
||||||
Icon = new(iconInfo);
|
Icon = new(iconInfo);
|
||||||
Icon.InitializeProperties();
|
Icon.InitializeProperties();
|
||||||
break;
|
|
||||||
case nameof(_properties):
|
|
||||||
UpdatePropertiesFromExtension(model as IExtendedAttributesProvider);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Microsoft.CommandPalette.Extensions;
|
using Microsoft.CommandPalette.Extensions;
|
||||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
@ -187,11 +188,14 @@ internal sealed partial class SampleListPage : ListPage
|
|||||||
{
|
{
|
||||||
private FontIconData _icon = new("\u0026", "Wingdings");
|
private FontIconData _icon = new("\u0026", "Wingdings");
|
||||||
|
|
||||||
public override IconInfo Icon => new IconInfo(_icon, _icon);
|
public override IconInfo Icon => new(_icon, _icon);
|
||||||
|
|
||||||
public override string Name => "Whatever";
|
public override string Name => "Whatever";
|
||||||
|
|
||||||
public IDictionary<string, object> GetProperties() => new Dictionary<string, object>()
|
// LOAD-BEARING: Use a Windows.Foundation.Collections.ValueSet as the
|
||||||
|
// backing store for Properties. A regular `Dictionary<string, object>`
|
||||||
|
// will not work across the ABI
|
||||||
|
public IDictionary<string, object> GetProperties() => new Windows.Foundation.Collections.ValueSet()
|
||||||
{
|
{
|
||||||
{ "Foo", "bar" },
|
{ "Foo", "bar" },
|
||||||
{ "Secret", 42 },
|
{ "Secret", 42 },
|
||||||
@ -215,7 +219,10 @@ internal sealed partial class SampleListPage : ListPage
|
|||||||
return CommandResult.ShowToast("whoop");
|
return CommandResult.ShowToast("whoop");
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDictionary<string, object> GetProperties() => new Dictionary<string, object>()
|
// LOAD-BEARING: Use a Windows.Foundation.Collections.ValueSet as the
|
||||||
|
// backing store for Properties. A regular `Dictionary<string, object>`
|
||||||
|
// will not work across the ABI
|
||||||
|
public IDictionary<string, object> GetProperties() => new Windows.Foundation.Collections.ValueSet()
|
||||||
{
|
{
|
||||||
{ "yo", "dog" },
|
{ "yo", "dog" },
|
||||||
{ "Secret", 12345 },
|
{ "Secret", 12345 },
|
||||||
@ -232,27 +239,32 @@ internal sealed partial class SampleListPage : ListPage
|
|||||||
/// Segoe MDL2 Assets font for glyphs in the Segoe UI Symbol range, or Segoe
|
/// 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
|
/// UI for any other glyphs. This class is only needed if you want a non-Segoe
|
||||||
/// font icon.
|
/// font icon.
|
||||||
///
|
///
|
||||||
/// WHY ISN'T THIS IN THE TOOLKIT: I have NO idea why, but if you put this
|
/// 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
|
/// in the toolkit, and not in your extension code, we 100% fail to cast
|
||||||
/// the `Dictionary` to an IDictionary. The error was in
|
/// the `Dictionary` to an IDictionary. The error was in
|
||||||
/// `IExtendedAttributesProvider:Do_Abi_GetProperties_0`
|
/// `IExtendedAttributesProvider:Do_Abi_GetProperties_0`
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed partial class FontIconData : IconData, IExtendedAttributesProvider
|
internal sealed partial class FontIconData : IconData, IExtendedAttributesProvider
|
||||||
{
|
{
|
||||||
private string FontFamily { get; set; }
|
private string FontFamily { get; set; }
|
||||||
|
|
||||||
private readonly Dictionary<string, object> _properties;
|
// LOAD-BEARING: Use a Windows.Foundation.Collections.ValueSet as the
|
||||||
|
// backing store for Properties. A regular `Dictionary<string, object>`
|
||||||
public IDictionary<string, object>? GetProperties() => _properties;
|
// will not work across the ABI
|
||||||
|
private readonly Windows.Foundation.Collections.ValueSet _properties;
|
||||||
|
|
||||||
|
public IDictionary<string, object> GetProperties() => _properties;
|
||||||
|
|
||||||
public FontIconData(string glyph, string fontFamily)
|
public FontIconData(string glyph, string fontFamily)
|
||||||
: base(glyph)
|
: base(glyph)
|
||||||
{
|
{
|
||||||
FontFamily = fontFamily;
|
FontFamily = fontFamily;
|
||||||
_properties = new Dictionary<string, object>()
|
|
||||||
|
_properties = new Windows.Foundation.Collections.ValueSet()
|
||||||
{
|
{
|
||||||
{ "FontFamily", FontFamily },
|
{ "FontFamily", FontFamily },
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user