using System; using System.Windows.Input; namespace BeWo.Core.Commands { public class ButtonClickCommand : ICommand { private readonly Action _ExecuteNoParameters; public bool IsExecutionAllowed { get; set; } public ButtonClickCommand(Action executeNoParameters, bool isExecutionAllowed = true) { IsExecutionAllowed = isExecutionAllowed; _ExecuteNoParameters = executeNoParameters; } public bool CanExecute(object parameter) { return IsExecutionAllowed; } public void Execute(object parameter) { _ExecuteNoParameters.Invoke(); } public event EventHandler CanExecuteChanged; } }