Pulagara Murali

Pulagara Murali

  • NA
  • 43
  • 43.6k

Command.Cs

Aug 21 2012 3:37 AM
using System;
using System.Windows.Input;
using System.Diagnostics;
using System.Threading;

namespace Symphony.Care5000.MainMaster
{
    public class Command : ICommand
    {
        private readonly Action _handler;
        Func<object, bool> canExecute;
        Action<object> executeAction;

        public Command(Action handler)
        {
            _handler = handler;
        }

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

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

        public Command(Action<object> executeAction, Func<object, bool> canExecute)
        {
            this.executeAction = executeAction;
            this.canExecute = canExecute;
        }

        #region ICommand Members
        public event EventHandler CanExecuteChanged = null;

        #endregion
    }
}