using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Input; namespace Remotely.Desktop.Unix.Services { public class Executor : ICommand { public Executor(Action executeAction, Predicate isExecutable = null) { ExecuteAction = executeAction; IsExecutable = isExecutable; } #pragma warning disable public event EventHandler CanExecuteChanged; #pragma warning restore private Action ExecuteAction { get; set; } private Predicate IsExecutable { get; set; } public bool CanExecute(object parameter) { if (IsExecutable == null) { return true; } return IsExecutable.Invoke(parameter); } public void Execute(object parameter) { ExecuteAction.Invoke(parameter); } } }