1 // -------------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All Rights Reserved.
3 // -------------------------------------------------------------------
4 //From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data
5 namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data
8 using System.Windows.Input;
9 using System.Diagnostics.CodeAnalysis;
12 internal sealed class DelegateCommand : ICommand
14 private SimpleEventHandler handler;
15 private bool isEnabled = true;
17 public DelegateCommand(SimpleEventHandler handler)
19 this.handler = handler;
23 public event EventHandler CanExecuteChanged;
27 get { return this.isEnabled; }
29 void ICommand.Execute(object arg)
34 bool ICommand.CanExecute(object arg)
36 return this.IsEnabled;
39 [SuppressMessage(FxCop.Category.Performance, FxCop.Rule.AvoidUncalledPrivateCode, Justification = "This is required by the ICommand interface.")]
40 private void OnCanExecuteChanged()
42 if (this.CanExecuteChanged != null)
44 this.CanExecuteChanged(this, EventArgs.Empty);
47 public delegate void SimpleEventHandler();