22 lines
526 B
C#
22 lines
526 B
C#
using System;
|
|
using System.Windows.Input;
|
|
|
|
namespace EveryPublish.Client.Services;
|
|
|
|
/// <summary>极简 ICommand 实现(托盘命令用,免 CommunityToolkit 依赖)</summary>
|
|
public class SimpleCommand : ICommand
|
|
{
|
|
private readonly Action _action;
|
|
|
|
public SimpleCommand(Action action)
|
|
{
|
|
_action = action;
|
|
}
|
|
|
|
public event EventHandler? CanExecuteChanged { add { } remove { } }
|
|
|
|
public bool CanExecute(object? parameter) => true;
|
|
|
|
public void Execute(object? parameter) => _action();
|
|
}
|