Class AppUiContext
- Namespace
- VpnHood.AppLib.Abstractions.UiContexts
- Assembly
- VpnHood.AppLib.Abstractions.dll
Provides the app's current UI context, which the platform sets while its UI is up.
public static class AppUiContext
- Inheritance
-
AppUiContext
- Inherited Members
Properties
Context
Gets or sets the app's UI context, as the platform supplies it, or null while it supplies none.
public static IUiContext? Context { get; set; }
Property Value
Remarks
A context may stay while its window is hidden, as the desktop's does: whether the UI is in front is the context's own IsActive().
IsPartialIntentRunning
Gets a value indicating whether a partial intent is running: a system screen over the app's, as a permission's, which pauses the app's own while it stays in front.
public static bool IsPartialIntentRunning { get; }
Property Value
RequiredContext
Gets the app's UI context, as Context gives it.
public static IUiContext RequiredContext { get; }
Property Value
Exceptions
- UiContextNotAvailableException
No UI context is set.
Methods
CreatePartialIntentScope()
Marks a partial intent as running until the scope is disposed.
public static IDisposable CreatePartialIntentScope()
Returns
- IDisposable
The scope.
NotifyResumed()
Raises OnResumed, as the platform does when the app comes back to the foreground.
public static void NotifyResumed()
Remarks
It may be called from any thread; a listener moves its own work off the caller's.
Events
OnChanged
Occurs when Context changes.
public static event EventHandler? OnChanged
Event Type
OnResumed
Occurs when the app comes back to the foreground, as each platform raises it from its own resume (iOS's WillEnterForeground, Android's OnResume, Windows' Activated).
public static event EventHandler? OnResumed
Event Type
Remarks
The local web server listens to it, to mend a loopback listener the OS may have torn down while the app was in the background, as iOS does.