using CommunityToolkit.Mvvm.Input; using System; using System.Threading.Tasks; namespace Ryujinx.Ava.UI.Helpers { #nullable enable public static class Commands { public static RelayCommand Create(Action action) => new(action); public static RelayCommand CreateConditional(Action action, Func canExecute) => new(action, canExecute); public static RelayCommand Create(Action action) => new(action); public static RelayCommand CreateConditional(Action action, Predicate canExecute) => new(action, canExecute); public static AsyncRelayCommand Create(Func action) => new(action, AsyncRelayCommandOptions.None); public static AsyncRelayCommand CreateConcurrent(Func action) => new(action, AsyncRelayCommandOptions.AllowConcurrentExecutions); public static AsyncRelayCommand CreateSilentFail(Func action) => new(action, AsyncRelayCommandOptions.FlowExceptionsToTaskScheduler); public static AsyncRelayCommand Create(Func action) => new(action, AsyncRelayCommandOptions.None); public static AsyncRelayCommand CreateConcurrent(Func action) => new(action, AsyncRelayCommandOptions.AllowConcurrentExecutions); public static AsyncRelayCommand CreateSilentFail(Func action) => new(action, AsyncRelayCommandOptions.FlowExceptionsToTaskScheduler); public static AsyncRelayCommand CreateConditional(Func action, Func canExecute) => new(action, canExecute, AsyncRelayCommandOptions.None); public static AsyncRelayCommand CreateConcurrentConditional(Func action, Func canExecute) => new(action, canExecute, AsyncRelayCommandOptions.AllowConcurrentExecutions); public static AsyncRelayCommand CreateSilentFailConditional(Func action, Func canExecute) => new(action, canExecute, AsyncRelayCommandOptions.FlowExceptionsToTaskScheduler); public static AsyncRelayCommand CreateConditional(Func action, Predicate canExecute) => new(action, canExecute, AsyncRelayCommandOptions.None); public static AsyncRelayCommand CreateConcurrentConditional(Func action, Predicate canExecute) => new(action, canExecute, AsyncRelayCommandOptions.AllowConcurrentExecutions); public static AsyncRelayCommand CreateSilentFailConditional(Func action, Predicate canExecute) => new(action, canExecute, AsyncRelayCommandOptions.FlowExceptionsToTaskScheduler); } }