mirror of
https://github.com/microsoft/PowerToys
synced 2025-09-02 07:25:10 +00:00
:shipit:
This commit is contained in:
@@ -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 System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.CommandPalette.Extensions;
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
using Windows.Foundation;
|
||||
@@ -185,18 +184,14 @@ internal sealed partial class SampleListPage : ListPage
|
||||
{
|
||||
Title = "I also have properties",
|
||||
},
|
||||
new ListItem(new AnotherCommandWithProperties())
|
||||
{
|
||||
Title = "InvokableCommand, IHaveProperties",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
internal sealed partial class CommandWithProperties : InvokableCommand, ICommand2
|
||||
internal sealed partial class CommandWithProperties : InvokableCommand, ICommandWithProperties
|
||||
{
|
||||
public override string Name => "Whatever";
|
||||
|
||||
public IPropertySet OtherProperties => new PropertySet()
|
||||
public IPropertySet Properties => new PropertySet()
|
||||
{
|
||||
{ "Foo", "bar" },
|
||||
{ "Secret", 42 },
|
||||
@@ -205,9 +200,9 @@ internal sealed partial class SampleListPage : ListPage
|
||||
}
|
||||
|
||||
#nullable enable
|
||||
internal sealed partial class OtherCommandWithProperties : ICommand2, IInvokableCommand
|
||||
internal sealed partial class OtherCommandWithProperties : ICommandWithProperties, IInvokableCommand
|
||||
{
|
||||
public string Name => "Revetahw";
|
||||
public string Name => "Whatever 2";
|
||||
|
||||
public IIconInfo Icon => new IconInfo("\uF146");
|
||||
|
||||
@@ -223,52 +218,11 @@ internal sealed partial class SampleListPage : ListPage
|
||||
|
||||
public IPropertySet OtherProperties => new PropertySet()
|
||||
{
|
||||
{ "Foo", "bar" },
|
||||
{ "Secret", 42 },
|
||||
{ "yo", "dawg" },
|
||||
{ "Secret", 12345 },
|
||||
{ "hmm?", null },
|
||||
};
|
||||
}
|
||||
|
||||
internal sealed partial class JustHasProps : ICommand2
|
||||
{
|
||||
public string Name => "JustHasProps";
|
||||
|
||||
public IIconInfo Icon => new IconInfo("\uF147");
|
||||
|
||||
public string Id => string.Empty;
|
||||
|
||||
public event TypedEventHandler<object, IPropChangedEventArgs>? PropChanged;
|
||||
|
||||
public ICommandResult Invoke(object sender)
|
||||
{
|
||||
PropChanged?.Invoke(this, new PropChangedEventArgs(nameof(Name)));
|
||||
return CommandResult.ShowToast("whoop");
|
||||
}
|
||||
|
||||
public IPropertySet OtherProperties => new PropertySet()
|
||||
{
|
||||
{ "Foo", "bar" },
|
||||
{ "Secret", 42 },
|
||||
{ "hmm?", null },
|
||||
};
|
||||
}
|
||||
|
||||
internal sealed partial class AnotherCommandWithProperties : InvokableCommand, IHaveProperties
|
||||
{
|
||||
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(IHaveProperties))]
|
||||
static AnotherCommandWithProperties()
|
||||
{
|
||||
}
|
||||
|
||||
public override string Name => "Another";
|
||||
|
||||
public override IconInfo Icon => new IconInfo("\uF147");
|
||||
|
||||
public IPropertySet Properties => new PropertySet()
|
||||
{
|
||||
{ "it", "doesn't" },
|
||||
{ "matter", 42 },
|
||||
{ "nothing seems to", "work" },
|
||||
};
|
||||
public IPropertySet Properties => throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user