diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs | 45 |
1 files changed, 6 insertions, 39 deletions
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs index e54cb6e86..38e3a9858 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs @@ -12,8 +12,6 @@ namespace Tango.Touch.Controls { public class TouchButton : Button, ITouchControl { - private bool _executingDelayCommand; - #region ITouchControl public CornerRadius CornerRadius @@ -86,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, (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 { @@ -103,49 +101,18 @@ 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() { - if (IsEnabled) - { - base.OnClick(); - PerformDelayCommand(); - } + base.OnClick(); + PerformDelayCommand(); } private async void PerformDelayCommand() { - if (DelayCommand != null && !_executingDelayCommand) + if (DelayCommand != null) { - try - { - _executingDelayCommand = true; - await Task.Delay(DelayCommandDuration.TimeSpan); - DelayCommand.Execute(CommandParameter); - } - catch (Exception) - { - throw; - } - finally - { - _executingDelayCommand = false; - } + await Task.Delay(DelayCommandDuration.TimeSpan); + DelayCommand.Execute(CommandParameter); } } |
