AppHandle
Namespace NetWiv · Assembly NetWiv.Core
public sealed class AppHandle : IDisposableProperties
Section titled “Properties”DefaultWindowIcon
Section titled “DefaultWindowIcon”public ImageData DefaultWindowIcon { get; }Events
Section titled “Events”public EventBus Events { get; }LoggerFactory
Section titled “LoggerFactory”public ILoggerFactory LoggerFactory { get; }The logger factory used by NetWiv and its plugins; a no-op factory when none is configured.
Metadata
Section titled “Metadata”public AppMetadata Metadata { get; }Resources
Section titled “Resources”public ResourceTable Resources { get; }Services
Section titled “Services”public IServiceProvider Services { get; }The application’s root service provider, or an empty provider when none is configured.
WebviewWindows
Section titled “WebviewWindows”public IReadOnlyCollection<WebviewWindow> WebviewWindows { get; }Webviews
Section titled “Webviews”public IReadOnlyCollection<Webview> Webviews { get; }Windows
Section titled “Windows”public IReadOnlyCollection<Window> Windows { get; }Methods
Section titled “Methods”AssetProtocolScope
Section titled “AssetProtocolScope”public FileScope AssetProtocolScope();Dispatch
Section titled “Dispatch”public void Dispatch(Action action);Dispose
Section titled “Dispose”public void Dispose();public void Emit(string eventName, JsonElement payload, string label = null);public void Emit(string eventName, JsonElement payload, RuntimeEventTarget target);EmitTo
Section titled “EmitTo”public void EmitTo(RuntimeEventTarget target, string eventName, JsonElement payload);public void EmitTo(string label, string eventName, JsonElement payload);EvaluateScript
Section titled “EvaluateScript”public void EvaluateScript(string webviewLabel, string script);public void Exit(int exitCode = 0);GetAllWebviewWindowsAsync
Section titled “GetAllWebviewWindowsAsync”public Task<IReadOnlyList<WebviewWindow>> GetAllWebviewWindowsAsync(CancellationToken cancellationToken = null);Matches the pinned guest API, which wraps every native window label, including bare windows.
GetAllWebviewsAsync
Section titled “GetAllWebviewsAsync”public Task<IReadOnlyList<Webview>> GetAllWebviewsAsync(CancellationToken cancellationToken = null);GetAllWindowsAsync
Section titled “GetAllWindowsAsync”public Task<IReadOnlyList<Window>> GetAllWindowsAsync(CancellationToken cancellationToken = null);Queries live native windows instead of the local lifecycle snapshot.
GetFocusedWindowAsync
Section titled “GetFocusedWindowAsync”public Task<Window> GetFocusedWindowAsync(CancellationToken cancellationToken = null);GetWebview
Section titled “GetWebview”public Webview GetWebview(string label);Returns the managed WebView, or null when the label is absent.
GetWebviewAsync
Section titled “GetWebviewAsync”public Task<Webview> GetWebviewAsync(string label, CancellationToken cancellationToken = null);GetWebviewWindow
Section titled “GetWebviewWindow”public WebviewWindow GetWebviewWindow(string label);Returns the managed WebView window, or null when the label is absent or belongs to a bare window.
GetWebviewWindowAsync
Section titled “GetWebviewWindowAsync”public Task<WebviewWindow> GetWebviewWindowAsync(string label, CancellationToken cancellationToken = null);GetWindow
Section titled “GetWindow”public Window GetWindow(string label);Returns the managed window, or null when the label is absent.
GetWindowAsync
Section titled “GetWindowAsync”public Task<Window> GetWindowAsync(string label, CancellationToken cancellationToken = null);InvokeAsync
Section titled “InvokeAsync”public ValueTask<JsonElement> InvokeAsync(string command, JsonElement args, CancellationToken cancellationToken = null);InvokeResponseAsync
Section titled “InvokeResponseAsync”public ValueTask<RuntimeInvokeResponse> InvokeResponseAsync(string command, JsonElement args, CancellationToken cancellationToken = null);Listen
Section titled “Listen”public IDisposable Listen(string eventName, Action<AppEvent> handler);ListenAny
Section titled “ListenAny”public IDisposable ListenAny(string eventName, Action<AppEvent> handler);Manage
Section titled “Manage”public bool Manage<T>(T value);OnMenuEvent
Section titled “OnMenuEvent”public void OnMenuEvent(Action<AppHandle, MenuEvent> handler);OnTrayIconEvent
Section titled “OnTrayIconEvent”public void OnTrayIconEvent(Action<AppHandle, TrayIconEvent> handler);public IDisposable Once(string eventName, Action<AppEvent> handler);OnceAny
Section titled “OnceAny”public IDisposable OnceAny(string eventName, Action<AppEvent> handler);ResolveAsset
Section titled “ResolveAsset”public AssetResponse ResolveAsset(AssetRequest request);Resolves a bundled application asset with the configured response headers and CSP.
ResolveDirectoryAsync
Section titled “ResolveDirectoryAsync”public Task<string> ResolveDirectoryAsync(int directory, string path = null, CancellationToken cancellationToken = null);Restart
Section titled “Restart”public void Restart();Requests exit and relaunch after Run returns and application resources have been disposed.
public State<T> State<T>();TryAssetProtocolScope
Section titled “TryAssetProtocolScope”public FileScope TryAssetProtocolScope();TryPlugin
Section titled “TryPlugin”public T TryPlugin<T>();TryState
Section titled “TryState”public State<T>? TryState<T>();Unlisten
Section titled “Unlisten”public void Unlisten(long id);Unmanage
Section titled “Unmanage”public bool Unmanage<T>(out T value);Events
Section titled “Events”EventHandlerFailed
Section titled “EventHandlerFailed”public event Action<AppEvent, Exception> EventHandlerFailed;Reports asynchronous event-handler or follow-up failures. Without a subscriber, failures are written to standard error.