using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Input;

namespace SFMVVM.Models
{
    public class CommandHandler : ICommand
    {
        private bool _canexecute;
        private Action _action;

        public CommandHandler(bool canexecute, Action Action)
        {
            _canexecute = canexecute;
            _action = Action;
        }

        public event EventHandler CanExecuteChanged;

        public bool CanExecute(object parameter)
        {
            return _canexecute;
        }

        public void Execute(object parameter)
        {
            _action();
        }
    }
}
