RunicFileDrop record

Namespace Runic.Application.Views in Runic.Application.Views 0.23.0

public sealed record RunicFileDrop : IEquatable<RunicFileDrop>

Inherits or implements IEquatable.

One drop of files onto a Window, for IRunicFileDropTarget.

Parameters

Files

The dropped files and directories, in the order the platform reported them; at least one.

Target

The data-runic-drop-target attribute of the nearest element under the drop that has one, or null. The page reports it: use it as an untrusted routing label, such as which folder of a list the files were dropped on, never as a path and never for an access decision.

Remarks

RunicFileDrop.Files may be empty when RunicFileDrop.PromisedFiles is not: a drop of files that had no local path, such as a mail attachment dragged from macOS Mail.

Constructors

RunicFileDrop

public RunicFileDrop(IReadOnlyList<RunicDroppedFile> Files, string? Target = null)

One drop of files onto a Window, for IRunicFileDropTarget.

Parameters

Files

The dropped files and directories, in the order the platform reported them; at least one.

Target

The data-runic-drop-target attribute of the nearest element under the drop that has one, or null. The page reports it: use it as an untrusted routing label, such as which folder of a list the files were dropped on, never as a path and never for an access decision.

Remarks

RunicFileDrop.Files may be empty when RunicFileDrop.PromisedFiles is not: a drop of files that had no local path, such as a mail attachment dragged from macOS Mail.

Properties

Effect

public RunicDropEffect Effect { get; init; }

Gets what the drop performed: copy, move or link; RunicDropEffect.Copy by default.

Remarks

The effect the drag source and the page agreed on, from the source's allowed effects, the user's modifier keys and the page's data-runic-drop-effect attribute. On Windows the page reports it, so treat it like RunicFileDrop.Target: to choose between copying and moving the files into the application, never for an access decision.

Files

public IReadOnlyList<RunicDroppedFile> Files { get; init; }

The dropped files and directories, in the order the platform reported them; at least one.

InSidePanel

public bool InSidePanel { get; init; }

Gets whether the files were dropped onto the Window's side panel rather than its page.

Remarks

The side panel's page (IRunicWindowPresentation.OpenSidePanelAsync) binds to the same ViewModel tree, so its drops reach the same root ViewModel, under the same rules; RunicFileDrop.Target then is the label of the panel page's element. The native window sets this from the view that received the drop, so unlike RunicFileDrop.Target it is trusted.

PromisedFiles

public IReadOnlyList<RunicPromisedFile> PromisedFiles { get; init; }

Gets the dropped files that had no local path, each readable once; empty for most drops.

Remarks

The host received them into private staging files. Read each with RunicPromisedFile.OpenReadAsync during the handler and dispose it when done; the host disposes the files that were not opened, deleting their staged copies, when the handler's task completes.

Target

public string? Target { get; init; }

The data-runic-drop-target attribute of the nearest element under the drop that has one, or null. The page reports it: use it as an untrusted routing label, such as which folder of a list the files were dropped on, never as a path and never for an access decision.