WindowsElevationOptions record

Namespace Runic.Platform.Windows.Elevation in Runic.Platform.Windows.Elevation 0.23.0

public sealed record WindowsElevationOptions : IEquatable<WindowsElevationOptions>

Inherits or implements IEquatable.

Where the helpers are and how the elevation prompt is shown.

Remarks

The generated PrivilegedActions.WindowsElevation holds the WindowsProgram metadata of the RunicPrivilegedAction items; add the other settings with with.

Constructors

WindowsElevationOptions

public WindowsElevationOptions()

No documentation.

Properties

ApplicationDirectory

public string? ApplicationDirectory { get; init; }

The directory relative helper paths start from, such as C:\Program Files\Example. Null is the application's own directory (AppContext.BaseDirectory).

Owner

public INativeWindowOwner? Owner { get; init; }

The window that owns the UAC prompt, so the prompt comes to the front, such as a Runic Desktop window's NativeOwner; null for none. Its handle is read on its own thread when the prompt is shown; a window that has closed by then leaves the prompt unowned.

Programs

public IReadOnlyDictionary<string, string>? Programs { get; init; }

The helper of each action by action ID, from its WindowsProgram metadata: a path relative to WindowsElevationOptions.ApplicationDirectory or an absolute path. An action without an entry uses the file name of its declared program with .exe, in WindowsElevationOptions.ApplicationDirectory.

TerminateAfterCancellation

public TimeSpan? TerminateAfterCancellation { get; init; }

How long a running action may take to stop after cancellation before its process is terminated. Null, the default, never terminates it: as on Linux, the result reports how the action actually ended. When the process cannot be terminated (the handle UAC gives a non-elevated application may not allow it), the result is PlatformFailureCode.PermissionDenied and the helper may still run.