diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-11-29 14:37:18 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-11-29 14:37:18 +0200 |
| commit | 1fabacea3865a285f34a706a4a83006a7e59fb50 (patch) | |
| tree | 97478d2ccf7742c7d623f28136452bfe7c54b686 /Software/Visual_Studio/Tango.Touch/Controls | |
| parent | a431b1dd895834a517bf65a9cddc88162d432fd2 (diff) | |
| download | Tango-1fabacea3865a285f34a706a4a83006a7e59fb50.tar.gz Tango-1fabacea3865a285f34a706a4a83006a7e59fb50.zip | |
Fixed issue with machine creation from prototype and cats.
Fixed issue with many clicks on job summary dye/back.
Diffstat (limited to 'Software/Visual_Studio/Tango.Touch/Controls')
| -rw-r--r-- | Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs index 38e3a9858..e54cb6e86 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs @@ -12,6 +12,8 @@ namespace Tango.Touch.Controls { public class TouchButton : Button, ITouchControl { + private bool _executingDelayCommand; + #region ITouchControl public CornerRadius CornerRadius @@ -84,7 +86,7 @@ namespace Tango.Touch.Controls set { SetValue(DelayCommandProperty, value); } } public static readonly DependencyProperty DelayCommandProperty = - DependencyProperty.Register("DelayCommand", typeof(ICommand), typeof(TouchButton), new PropertyMetadata(null,(d,e) => (d as TouchButton).OnDelayCommandChanged())); + DependencyProperty.Register("DelayCommand", typeof(ICommand), typeof(TouchButton), new PropertyMetadata(null, (d, e) => (d as TouchButton).OnDelayCommandChanged())); public Duration DelayCommandDuration { @@ -101,18 +103,49 @@ namespace Tango.Touch.Controls } + protected override void OnPreviewMouseDoubleClick(MouseButtonEventArgs e) + { + e.Handled = true; + } + + protected override void OnPreviewMouseDown(MouseButtonEventArgs e) + { + if (e.ClickCount >= 2) + { + e.Handled = true; + return; + } + + base.OnPreviewMouseDown(e); + } + protected override void OnClick() { - base.OnClick(); - PerformDelayCommand(); + if (IsEnabled) + { + base.OnClick(); + PerformDelayCommand(); + } } private async void PerformDelayCommand() { - if (DelayCommand != null) + if (DelayCommand != null && !_executingDelayCommand) { - await Task.Delay(DelayCommandDuration.TimeSpan); - DelayCommand.Execute(CommandParameter); + try + { + _executingDelayCommand = true; + await Task.Delay(DelayCommandDuration.TimeSpan); + DelayCommand.Execute(CommandParameter); + } + catch (Exception) + { + throw; + } + finally + { + _executingDelayCommand = false; + } } } |
