// 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.ComponentModel;
using System.Threading.Tasks;
namespace CommunityToolkit.Mvvm.Input;
///
/// An interface expanding to support asynchronous operations.
///
public interface IAsyncRelayCommand : IRelayCommand, INotifyPropertyChanged
{
///
/// Gets the last scheduled , if available.
/// This property notifies a change when the completes.
///
Task? ExecutionTask { get; }
///
/// Gets a value indicating whether running operations for this command can be canceled.
///
bool CanBeCanceled { get; }
///
/// Gets a value indicating whether a cancelation request has been issued for the current operation.
///
bool IsCancellationRequested { get; }
///
/// Gets a value indicating whether the command currently has a pending operation being executed.
///
bool IsRunning { get; }
///
/// Provides a more specific version of ,
/// also returning the representing the async operation being executed.
///
/// The input parameter.
/// The representing the async operation being executed.
Task ExecuteAsync(object? parameter);
///
/// Communicates a request for cancelation.
///
///
/// If the underlying command is not running, or if it does not support cancelation, this method will perform no action.
/// Note that even with a successful cancelation, the completion of the current operation might not be immediate.
///
void Cancel();
}