diff options
author | 2012-10-24 23:38:06 +0400 | |
---|---|---|
committer | 2012-10-24 23:38:06 +0400 | |
commit | 8316abc300d56f876a5fe3b511dc202556ad776c (patch) | |
tree | 765788affac60e3819993e7f9803ba14070034ff /Juick/Classes/DelegateCommand.cs | |
parent | 61d3230b053453c9f8e145341a3def0d1ad8ff32 (diff) |
loading data on scrolling at bottom
Diffstat (limited to 'Juick/Classes/DelegateCommand.cs')
-rw-r--r-- | Juick/Classes/DelegateCommand.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Juick/Classes/DelegateCommand.cs b/Juick/Classes/DelegateCommand.cs new file mode 100644 index 0000000..cc7adcd --- /dev/null +++ b/Juick/Classes/DelegateCommand.cs @@ -0,0 +1,37 @@ +using System; +using System.Windows.Input; + +namespace Juick.Classes +{ + public class DelegateCommand : ICommand + { + readonly Action action; + readonly Func<bool> canExecute; + + public DelegateCommand(Action execute, Func<bool> canExecute) + { + this.action = execute; + this.canExecute = canExecute; + } + + public bool CanExecute(object parameter) + { + return canExecute(); + } + + public event EventHandler CanExecuteChanged; + + public void Execute(object parameter) + { + action(); + } + + public void NotifyCanExecuteChanged() + { + if (CanExecuteChanged != null) + { + CanExecuteChanged(this, EventArgs.Empty); + } + } + } +} |