Class ScreenActivityContext
- Namespace
- MackySoft.Navigathena
- Assembly
- MackySoft.Navigathena.dll
Provides navigation and cancellation for one foreground activation period.
public class ScreenActivityContext
- Inheritance
-
ScreenActivityContext
- Derived
- Inherited Members
Remarks
The period ends on departure or modal cover. A retained return receives a new context. Rendering, game simulation and binding-owned work are not owned by this period.
Properties
CancellationToken
Signals the end of this activation period. Use a separate lifetime for work that must survive modal cover.
public CancellationToken CancellationToken { get; }
Property Value
EntryId
public NavigationEntryId EntryId { get; }
Property Value
ForegroundToken
The valid operation qualification for this activation. Native input and focus admission are ready when activation starts.
public ScreenForegroundToken ForegroundToken { get; }
Property Value
Remarks
Retain this value when accepting an operation. Departure invalidates it before native focus-loss callbacks; a later activation supplies a different token.
IsFirstActivation
True until this history entry has successfully completed its first activation transition.
public bool IsFirstActivation { get; }
Property Value
Navigation
public IScreenNavigation Navigation { get; }
Property Value
PreparationReason
public ScreenPreparationReason? PreparationReason { get; }
Property Value
Reason
public ScreenActivationReason Reason { get; }
Property Value
RegionId
public RegionInstanceId RegionId { get; }
Property Value
Methods
StartWork(Func<ScreenWorkContext, ValueTask>)
Schedules owned work after the current navigation settles. Do not await its completion inside a lifecycle callback.
public ScreenWork StartWork(Func<ScreenWorkContext, ValueTask> work)
Parameters
workFunc<ScreenWorkContext, ValueTask>The complete asynchronous operation, including any cleanup that uses screen resources.
Returns
- ScreenWork
A handle for observing completion or requesting execution cancellation.
Remarks
Work registered during activation starts only after activation succeeds; a failed activation cancels its pending work. Once started, work survives deactivation until it finishes, is canceled, or its screen binding ends.
Exceptions
- ArgumentNullException
workis null.- InvalidOperationException
This activity or its screen binding has ended.