wabbajack/Wabbajack/LambdaCommand.cs

29 lines
606 B
C#
Raw Normal View History

2019-07-31 03:59:19 +00:00
using System;
using System.Windows.Input;
namespace Wabbajack
{
internal class LambdaCommand : ICommand
{
private Action _execute;
private Func<bool> _canExecute;
public event EventHandler CanExecuteChanged;
public LambdaCommand(Func<bool> canExecute, Action execute)
{
_execute = execute;
_canExecute = canExecute;
}
public bool CanExecute(object parameter)
{
return _canExecute();
}
public void Execute(object parameter)
{
_execute();
}
}
}