<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
	<CodeSnippet Format="1.0.0">
		<Header>
			<Title>ICommand</Title>
			<Shortcut>icommand</Shortcut>
			<Description>Code snippet for ICommand Members</Description>
			<Author>Koen Hendriks</Author>
		</Header>
		<Snippet>
			<Code Language="csharp"><![CDATA[        #region ICommand Members

        public class DelegateCommand : ICommand
        {
            Func<object, bool> canExecute;
            Action<object> executeAction;

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

            public DelegateCommand(Action<object> executeAction, Func<object, bool> canExecute)
            {
                if (executeAction == null)
                {
                    throw new ArgumentNullException("executeAction");
                }
                this.executeAction = executeAction;
                this.canExecute = canExecute;
            }

            public bool CanExecute(object parameter)
            {
                bool result = true;
                Func<object, bool> canExecuteHandler = this.canExecute;
                if (canExecuteHandler != null)
                {
                    result = canExecuteHandler(parameter);
                }

                return result;
            }

            public event EventHandler CanExecuteChanged;

            public void RaiseCanExecuteChanged()
            {
                EventHandler handler = this.CanExecuteChanged;
                if (handler != null)
                {
                    handler(this, new EventArgs());
                }
            }

            public void Execute(object parameter)
            {
                this.executeAction(parameter);
            }
        }

        #endregion]]>
			</Code>
		</Snippet>
	</CodeSnippet>
</CodeSnippets>