diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-09-01 13:17:09 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-09-01 13:17:09 +0300 |
| commit | b3ffc4c7ba0b7f9bb34c878ae186d380ac41a07f (patch) | |
| tree | fe3a837d1e3fe80058c411acd2bc9a10fa5679e7 /Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs | |
| parent | 49341fed6890212404695d6fab86d84bd6af8414 (diff) | |
| download | Tango-b3ffc4c7ba0b7f9bb34c878ae186d380ac41a07f.tar.gz Tango-b3ffc4c7ba0b7f9bb34c878ae186d380ac41a07f.zip | |
PPC: Disabled button while job is loading in Job Summery.
Diffstat (limited to 'Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs index ddf4c61a1..38e3a9858 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs @@ -84,7 +84,7 @@ namespace Tango.Touch.Controls set { SetValue(DelayCommandProperty, value); } } public static readonly DependencyProperty DelayCommandProperty = - DependencyProperty.Register("DelayCommand", typeof(ICommand), typeof(TouchButton), new PropertyMetadata(null)); + DependencyProperty.Register("DelayCommand", typeof(ICommand), typeof(TouchButton), new PropertyMetadata(null,(d,e) => (d as TouchButton).OnDelayCommandChanged())); public Duration DelayCommandDuration { @@ -116,6 +116,23 @@ namespace Tango.Touch.Controls } } + private void OnDelayCommandChanged() + { + if (DelayCommand != null) + { + DelayCommand.CanExecuteChanged -= DelayCommand_CanExecuteChanged; + DelayCommand.CanExecuteChanged += DelayCommand_CanExecuteChanged; + } + } + + private void DelayCommand_CanExecuteChanged(object sender, EventArgs e) + { + if (DelayCommand != null) + { + IsEnabled = DelayCommand.CanExecute(null); + } + } + static TouchButton() { DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchButton), new FrameworkPropertyMetadata(typeof(TouchButton))); |
