IDesktopOpenRegistration interface

Namespace Runic.Platform in Runic.Platform 0.23.0

public interface IDesktopOpenRegistration

Registers the application with the desktop for URL schemes and file types, for the current user.

Remarks

For an application that installs itself, such as a zip, an AppImage or dotnet run during development. A package registers the application itself (an MSIX manifest, a Flatpak or Snap export, a bundle's Info.plist): a packaged or sandboxed process reports PlatformUnavailableReason.BackendUnavailable.

Nothing is written until IDesktopOpenRegistration.RegisterAsync, which an application calls when the user agrees. A registration never replaces one that names another application: every item is checked before anything is written, and such an item is PlatformFailureCode.Conflict with nothing changed.

Methods

IsRegisteredAsync

ValueTask<PlatformResult<bool>> IsRegisteredAsync(DesktopOpenRegistration registration, CancellationToken cancellationToken = default)

Whether every scheme and file type of registration is registered for this application.

Returns

false when any item is missing or names another application.

RegisterAsync

ValueTask<PlatformResult<PlatformUnit>> RegisterAsync(DesktopOpenRegistration registration, CancellationToken cancellationToken = default)

Registers every scheme and file type of registration for this application, updating an earlier registration of its own.

Exceptions

ArgumentException

registration has neither a URL scheme nor a file type.

Remarks

PlatformFailureCode.Conflict, with a diagnostic and nothing written, when an item is registered by another application or by the application's package. It does not make the application the default.

UnregisterAsync

ValueTask<PlatformResult<bool>> UnregisterAsync(DesktopOpenRegistration registration, CancellationToken cancellationToken = default)

Removes what IDesktopOpenRegistration.RegisterAsync wrote for registration; entries of other applications stay.

Returns

Whether anything was removed.