diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2017-01-29 23:26:46 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2017-01-29 23:26:46 +0100 |
| commit | dc603ff31253879bb8effb6d529f266ff78e9f3e (patch) | |
| tree | e48f38ac22040da95371f661be482389b21e473e /src/Command.cs | |
| parent | 1a4fe8bd37ed4a3e3324a134df4f90c14b315918 (diff) | |
| parent | 2ec4eeed1d0353c455719aa612a12646ae2d176e (diff) | |
Merge improvements and debug from 'CrowIDE' branch
Diffstat (limited to 'src/Command.cs')
| -rw-r--r-- | src/Command.cs | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/Command.cs b/src/Command.cs index 35a7facc..f7a12465 100644 --- a/src/Command.cs +++ b/src/Command.cs @@ -35,16 +35,20 @@ namespace Crow #endregion #region CTOR - public Command () + public Command (Action _executeAction) { + execute = _executeAction; } #endregion + Action execute; + string caption; + Picture icon; bool isEnabled; - - [XmlAttributeAttribute()][DefaultValue(true)] + #region Public properties + [XmlAttributeAttribute][DefaultValue(true)] public virtual bool IsEnabled { get { return isEnabled; } set { @@ -54,7 +58,7 @@ namespace Crow NotifyValueChanged ("IsEnabled", isEnabled); } } - [XmlAttributeAttribute()][DefaultValue("Unamed Command")] + [XmlAttributeAttribute][DefaultValue("Unamed Command")] public virtual string Caption { get { return caption; } set { @@ -65,5 +69,27 @@ namespace Crow } } + [XmlAttributeAttribute] + public Picture Icon { + get { return icon; } + set { + if (icon == value) + return; + icon = value; + NotifyValueChanged ("Icon", icon); + } + } + #endregion + + public void Execute(){ + if (execute != null) + execute (); + } + internal void raiseAllValuesChanged(){ + NotifyValueChanged ("IsEnabled", isEnabled); + NotifyValueChanged ("Icon", icon); + NotifyValueChanged ("Caption", caption); + } + } } |