using System;
using System.Linq;
using System.Windows.Input;

namespace CustomPropertyGrid
{
//    class DelegateCommand : ICommand
//    {
//        public event EventHandler CanExecuteChanged;

//        private readonly Action<object> executeMethod = null;
//        private readonly Func<bool> canExecuteMethod = null;

//        public DelegateCommand(Action<object> executeMethod)
//            : this(executeMethod, null)
//        {
//        }

//        public DelegateCommand(Action<object> executeMethod, Func<bool> canExecuteMethod)
//        {
//            if (executeMethod == null && canExecuteMethod == null)
//                throw new ArgumentNullException("executeMethod cannot be null");

//            this.executeMethod = executeMethod;
//            this.canExecuteMethod = canExecuteMethod;
//        }

//        public void Execute(object parameter)
//        {
//            if (executeMethod == null) return;
//            executeMethod(parameter);
//        }

//        public bool CanExecute()
//        {
//            if (canExecuteMethod == null)
//            {
//                return true;
//            }
//            else
//            {
//                return canExecuteMethod();
//            }
//        }

//        bool ICommand.CanExecute(object parameter)
//        {
//            return CanExecute();
//        }

//        void ICommand.Execute(object parameter)
//        {
//            Execute(parameter);
//        }
//    }
}
