Skip to main content

ProjectVTransactionConfirmationCoordinator class

Drives a confirmation dialog: call Prepare to open it, ConfirmAsync or Cancel from its buttons, and redraw on Changed. Only one action runs at a time.

Namespace: SilverTiger.ProjectV.Unity.Presentation.Recovery

public sealed class ProjectVTransactionConfirmationCoordinator

Properties​

PropertyTypeDescription
StatusProjectVTransactionStatusWhere the current action is.
CurrentProjectVTransactionConfirmation?The dialog content being confirmed, or null when no dialog is open.
LastResultProjectVTransactionResult?The result of the last action, or null before one finishes.
IsBusyboolTrue while the action runs; disable the dialog buttons.
CanConfirmboolTrue when the Confirm button should be enabled: the dialog waits for the player, or the last outcome was unknown and the result allows a retry.
CanCancelboolTrue when the Cancel or Close button should be enabled: a dialog is open and no action is running.

Events​

EventTypeDescription
ChangedAction?Raised after any state change; redraw the dialog.

Methods​

Prepare(ProjectVTransactionConfirmation confirmation)​

Opens the dialog for confirmation: clears the last result, sets Status to ProjectVTransactionStatus.AwaitingConfirmation and raises Changed.

public void Prepare(ProjectVTransactionConfirmation confirmation);

Parameters

NameTypeDescription
confirmationProjectVTransactionConfirmationThe dialog content.

Exceptions

ExceptionWhen
ArgumentNullExceptionconfirmation is null.
InvalidOperationExceptionAn action is still running.

Cancel()​

Handles the dialog's Cancel or Close button. While the dialog waits for the player, the status becomes ProjectVTransactionStatus.Cancelled and the dialog content is kept; after a result, the dialog is closed and the status returns to ProjectVTransactionStatus.Idle.

public bool Cancel();

Returns

bool: True when something changed; false when no dialog is open or an action is running.

ConfirmAsync(Func<CancellationToken, Task<ProjectVTransactionResult>> execute, CancellationToken cancellationToken)​

Runs the confirmed action with execute and records its result. If an action is already running, returns that action's task and ignores execute.

public Task<ProjectVTransactionResult> ConfirmAsync(Func<CancellationToken, Task<ProjectVTransactionResult>> execute, CancellationToken cancellationToken);

Parameters

NameTypeDescription
executeFunc<CancellationToken, Task<ProjectVTransactionResult>>Runs the action and returns its final result; never null. If it throws, the result is ProjectVTransactionStatus.UnknownOutcome with Sync offered; if it is cancelled through cancellationToken, the result is ProjectVTransactionStatus.Cancelled.
cancellationTokenCancellationTokenPassed to execute.

Returns

Task<ProjectVTransactionResult>: A task that completes with the final result. An exception from execute becomes a result, not a failed task.

Exceptions

ExceptionWhen
ArgumentNullExceptionexecute is null.
InvalidOperationExceptionCanConfirm is false, or the player cannot afford Current.