[tasque/viewmodel: 34/78] Add UICommand.Executed event



commit 0f32f263b71f754aef96ff70745bde91dfd9d588
Author: Antonius Riha <antoniusriha gmail com>
Date:   Mon Jul 30 15:02:08 2012 +0200

    Add UICommand.Executed event

 src/libtasqueui/UICommand.cs |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/libtasqueui/UICommand.cs b/src/libtasqueui/UICommand.cs
index 5c2ec34..890f626 100644
--- a/src/libtasqueui/UICommand.cs
+++ b/src/libtasqueui/UICommand.cs
@@ -50,9 +50,11 @@ namespace Tasque.UIModel
 		
 		public override void Execute ()
 		{
-			if (CanExecute)
+			if (CanExecute) {
 				ExecuteAction ();
-			else
+				if (Executed != null)
+					Executed (this, EventArgs.Empty);
+			} else
 				Debug.WriteLine ("Cannot execute: " + (string.IsNullOrWhiteSpace(ErrorMessage)
 				                                       ? "(none given)" : ErrorMessage));
 		}
@@ -70,6 +72,8 @@ namespace Tasque.UIModel
 			CanExecute = canExecute;
 		}
 		
+		public event EventHandler Executed;
+		
 		Action executeAction;
 	}
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]