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​
| Property | Type | Description |
|---|---|---|
Status | ProjectVTransactionStatus | Where the current action is. |
Current | ProjectVTransactionConfirmation? | The dialog content being confirmed, or null when no dialog is open. |
LastResult | ProjectVTransactionResult? | The result of the last action, or null before one finishes. |
IsBusy | bool | True while the action runs; disable the dialog buttons. |
CanConfirm | bool | True 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. |
CanCancel | bool | True when the Cancel or Close button should be enabled: a dialog is open and no action is running. |
Events​
| Event | Type | Description |
|---|---|---|
Changed | Action? | 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
| Name | Type | Description |
|---|---|---|
confirmation | ProjectVTransactionConfirmation | The dialog content. |
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | confirmation is null. |
InvalidOperationException | An 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
| Name | Type | Description |
|---|---|---|
execute | Func<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. |
cancellationToken | CancellationToken | Passed 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
| Exception | When |
|---|---|
ArgumentNullException | execute is null. |
InvalidOperationException | CanConfirm is false, or the player cannot afford Current. |