26 lines
636 B
C#
26 lines
636 B
C#
namespace Common.UI.Infrastructure
|
|
{
|
|
using System;
|
|
using System.Windows.Input;
|
|
|
|
public class Command : ICommand
|
|
{
|
|
private readonly Action executable;
|
|
|
|
public Command(Action executable)
|
|
=> this.executable = executable;
|
|
|
|
public event EventHandler CanExecuteChanged
|
|
{
|
|
add => CommandManager.RequerySuggested += value;
|
|
remove => CommandManager.RequerySuggested -= value;
|
|
}
|
|
|
|
public bool CanExecute(object _)
|
|
=> this.executable != null;
|
|
|
|
public void Execute(object _)
|
|
=> this.executable?.Invoke();
|
|
}
|
|
}
|