using System;
using System.Windows.Input;

namespace Ocr.Gui.Model;

public class Command : ICommand
{
  public Action Action { get; set; }

  public Command(Action action)
  {
    Action = action;
  }

  #region Implementation of ICommand

  /// <inheritdoc />
  public bool CanExecute(object? parameter)
  {
    return true;
  }

  /// <inheritdoc />
  public void Execute(object? parameter)
  {
    Action?.Invoke();
  }

  /// <inheritdoc />
  public event EventHandler? CanExecuteChanged;

  #endregion
}
