Skip to content

Commit

Permalink
feat: ensure we prevent parallel execution if disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
dansiegel committed Oct 29, 2023
1 parent 1d33294 commit bc76194
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Prism.Core/Commands/AsyncDelegateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ public async Task Execute(CancellationToken cancellationToken = default)
{
try
{
if (!_enableParallelExecution && IsExecuting)
return;

IsExecuting = true;
await _executeMethod(cancellationToken);
}
Expand Down
3 changes: 3 additions & 0 deletions src/Prism.Core/Commands/AsyncDelegateCommand{T}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ public async Task Execute(T parameter, CancellationToken cancellationToken = def
{
try
{
if (!_enableParallelExecution && IsExecuting)
return;

IsExecuting = true;
await _executeMethod(parameter, cancellationToken);
}
Expand Down

0 comments on commit bc76194

Please sign in to comment.