<PackageReference Include="ReactiveUI.Primitives.Core" Version="7.4.0" />

ReactiveUI.Primitives.Signals.CommandSignal<TResult>

public sealed class CommandSignal<TResult> : IObservable<TResult>, IDisposable
Minimal reactive command that gates execution and publishes result, fault, and running state streams.
public bool CanRun { get; }

Gets a value indicating whether the command can currently run.

public IObservable<Exception> Faults { get; }

Gets command execution failures as values before the returned task rethrows them.

public StateSignal<bool> IsRunning { get; }

Gets a state signal that is true while an execution is in flight.

public IObservable<TResult> Results { get; }

Gets the successful command results.

public CommandSignal(Func<CancellationToken, Task<TResult>> execute)

Initializes a new instance of the CommandSignal<T> class.

public CommandSignal(Func<CancellationToken, Task<TResult>> execute, IObservable<bool> canRun)

Initializes a new instance of the CommandSignal<T> class.

public CommandSignal(Func<TResult> execute)

Initializes a new instance of the CommandSignal<T> class.

public CommandSignal(Func<TResult> execute, IObservable<bool> canRun)

Initializes a new instance of the CommandSignal<T> class.

public void Dispose()

Executes the Dispose operation.

public CommandExecution<TResult> ExecuteAsync()

Executes the command if allowed and publishes the result or fault.

public CommandExecution<TResult> ExecuteAsync(CancellationToken cancellationToken)

Executes the command if allowed and publishes the result or fault.

public IDisposable Subscribe(IObserver<TResult> observer)

Subscribes to successful command results.