// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; namespace CommunityToolkit.Mvvm.Input; /// /// Options to customize the behavior of and instances. /// [Flags] public enum AsyncRelayCommandOptions { /// /// No option is specified. The and types will use their default behavior: /// /// Concurrent execution is disallowed: a command is disabled if there is a pending asynchronous execution running. /// /// /// Exceptions are thrown on the calling context: calling will await the /// returned for the operation, and propagate the exception on the calling context. /// /// This behavior is consistent with synchronous commands, where exceptions in behave the same. /// /// /// None = 0, /// /// Concurrent executions are allowed. This option makes it so that the same command can be invoked concurrently multiple times. /// /// Note that additional considerations should be taken into account in this case: /// /// If the command supports cancellation, previous invocations will automatically be canceled if a new one is started. /// The property will always represent the operation that was started last. /// /// /// AllowConcurrentExecutions = 1 << 0, /// /// Exceptions are not thrown on the calling context, and are propagated to instead. /// /// This affects how calls to behave. When this option is used, if an operation fails, that exception will not /// be rethrown on the calling context (as it is not awaited there). Instead, it will flow to . /// /// /// This option enables more advanced scenarios, where the property can be used to inspect the state of an operation /// that was queued. That is, even if the operation failed or was canceled, the details of that can be retrieved at a later time by accessing this property. /// /// FlowExceptionsToTaskScheduler = 1 << 1 }