From 456e7c847a4aa6fed44cc2d970ac9400ea54d0c4 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Fri, 10 Feb 2017 15:54:50 +0100 Subject: TextBox, Label, simpler SVG icon for file sys viewers (improve speed a lot), divers debug and code clean --- src/Command.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/Command.cs') diff --git a/src/Command.cs b/src/Command.cs index f7a12465..1f744f84 100644 --- a/src/Command.cs +++ b/src/Command.cs @@ -45,17 +45,17 @@ namespace Crow string caption; Picture icon; - bool isEnabled; + bool canExecute = true; #region Public properties [XmlAttributeAttribute][DefaultValue(true)] - public virtual bool IsEnabled { - get { return isEnabled; } + public virtual bool CanExecute { + get { return canExecute; } set { - if (isEnabled == value) + if (canExecute == value) return; - isEnabled = value; - NotifyValueChanged ("IsEnabled", isEnabled); + canExecute = value; + NotifyValueChanged ("CanExecute", canExecute); } } [XmlAttributeAttribute][DefaultValue("Unamed Command")] @@ -82,11 +82,11 @@ namespace Crow #endregion public void Execute(){ - if (execute != null) + if (execute != null && CanExecute) execute (); } internal void raiseAllValuesChanged(){ - NotifyValueChanged ("IsEnabled", isEnabled); + NotifyValueChanged ("CanExecute", canExecute); NotifyValueChanged ("Icon", icon); NotifyValueChanged ("Caption", caption); } -- cgit v1.3.1-4-g156e