A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

19 lines
592 B

using System;
using System.Windows.Input;
namespace IntegrationTestApp;
internal class DelegateCommand : ICommand
{
private readonly Action _action;
private readonly Func<object?, bool> _canExecute;
public DelegateCommand(Action action, Func<object?, bool>? canExecute = default)
{
_action = action;
_canExecute = canExecute ?? new(_ => true);
}
public event EventHandler? CanExecuteChanged { add { } remove { } }
public bool CanExecute(object? parameter) => _canExecute(parameter);
public void Execute(object? parameter) => _action();
}