Given that you have a control that fires a command:
Is there a way to prevent the command from being fired
We solved it like this... with async we couldn't find any other way to effectively block extra clicks on the button which invokes this Click:
private SemaphoreSlim _lockMoveButton = new SemaphoreSlim(1);
private async void btnMove_Click(object sender, RoutedEventArgs e)
{
var button = sender as Button;
if (_lockMoveButton.Wait(0) && button != null)
{
try
{
button.IsEnabled = false;
}
finally
{
_lockMoveButton.Release();
button.IsEnabled = true;
}
}
}