using System; using System.Windows.Input; namespace AddInManager { internal class RelayCommand : ICommand { private Action execute; private Func canExecute; public event EventHandler CanExecuteChanged; public RelayCommand(Action execute, Func canExecute = null) { if (execute == null) throw new System.ArgumentNullException(); this.execute = execute; this.canExecute = canExecute; } public bool CanExecute(object parameter) { return canExecute == null || canExecute(parameter); } public void Execute(object parameter) { execute(parameter); } } }