ProjectVUiSubscriptions class
Subscribes UI to the sign-in, startup and header presenters, and logs when each update has been applied by your callback. Use these instead of SubscribeAsync for UI code. The log entry marks your callback returning, not the frame being drawn or the server finishing.
Namespace: SilverTiger.ProjectV.Unity.Presentation
public static class ProjectVUiSubscriptions
Methods
SubscribeUiAsync(IProjectVAuthenticationPresenter presenter, ProjectVUiBindingId bindingId, Action<ProjectVAuthenticationSnapshot> apply, CancellationToken cancellationToken)
Calls apply right away with the current sign-in snapshot, then with each newer one. Your callback runs on the thread that delivers the update; this method does not switch threads.
public static Task<IDisposable> SubscribeUiAsync(this IProjectVAuthenticationPresenter presenter, ProjectVUiBindingId bindingId, Action<ProjectVAuthenticationSnapshot> apply, CancellationToken cancellationToken = default);
Parameters
| Name | Type | Description |
|---|---|---|
presenter | IProjectVAuthenticationPresenter | The presenter to observe. |
bindingId | ProjectVUiBindingId | Must be ProjectVUiBindingId.LoginAuthentication. |
apply | Action<ProjectVAuthenticationSnapshot> | Updates your UI from a snapshot. |
cancellationToken | CancellationToken | Stops logging for this subscription once cancelled; it does not end the subscription. |
Returns
Task<IDisposable>: A subscription; dispose it to stop receiving updates.
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | presenter or apply is null. |
ArgumentOutOfRangeException | bindingId is not ProjectVUiBindingId.LoginAuthentication. |
SubscribeUiAsync(IProjectVStartupPresenter presenter, ProjectVUiBindingId bindingId, Action<ProjectVStartupSnapshot> apply, CancellationToken cancellationToken)
Calls apply right away with the current startup snapshot, then with each newer one. Your callback runs on the thread that delivers the update; this method does not switch threads.
public static Task<IDisposable> SubscribeUiAsync(this IProjectVStartupPresenter presenter, ProjectVUiBindingId bindingId, Action<ProjectVStartupSnapshot> apply, CancellationToken cancellationToken = default);
Parameters
| Name | Type | Description |
|---|---|---|
presenter | IProjectVStartupPresenter | The presenter to observe. |
bindingId | ProjectVUiBindingId | Must be ProjectVUiBindingId.LoginStartup. |
apply | Action<ProjectVStartupSnapshot> | Updates your UI from a snapshot. |
cancellationToken | CancellationToken | Stops logging for this subscription once cancelled; it does not end the subscription. |
Returns
Task<IDisposable>: A subscription; dispose it to stop receiving updates.
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | presenter or apply is null. |
ArgumentOutOfRangeException | bindingId is not ProjectVUiBindingId.LoginStartup. |
SubscribeUiAsync(IProjectVHeaderPresenter presenter, ProjectVUiBindingId bindingId, Action<ProjectVHeaderSnapshot> apply, CancellationToken cancellationToken)
Calls apply right away with the current header snapshot, then with each newer one. Your callback runs on the thread that delivers the update; this method does not switch threads.
public static Task<IDisposable> SubscribeUiAsync(this IProjectVHeaderPresenter presenter, ProjectVUiBindingId bindingId, Action<ProjectVHeaderSnapshot> apply, CancellationToken cancellationToken = default);
Parameters
| Name | Type | Description |
|---|---|---|
presenter | IProjectVHeaderPresenter | The presenter to observe. |
bindingId | ProjectVUiBindingId | Must be ProjectVUiBindingId.Header. |
apply | Action<ProjectVHeaderSnapshot> | Updates your UI from a snapshot. |
cancellationToken | CancellationToken | Stops logging for this subscription once cancelled; it does not end the subscription. |
Returns
Task<IDisposable>: A subscription; dispose it to stop receiving updates.
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | presenter or apply is null. |
ArgumentOutOfRangeException | bindingId is not ProjectVUiBindingId.Header. |