Files
YwxApp.AiChat/Commands/ParameterlessCommand.cs
2025-03-12 20:02:52 +08:00

30 lines
601 B
C#

using System.Windows.Input;
namespace YwxApp.AiChat.Commands
{
/// <summary>
/// relay command
/// </summary>
public class ParameterlessCommand : ICommand
{
private Action _execute;
public ParameterlessCommand(Action execute)
{
_execute = execute;
}
public event EventHandler? CanExecuteChanged;
public bool CanExecute(object? parameter)
{
return CanExecuteChanged != null;
}
public void Execute(object? parameter)
{
_execute.Invoke();
}
}
}