Перейти к основному содержимому
Версия: 11.0.0

Launcher v11.1

The Launcher allows you to open file or a URI link in the default app associated with the specified argument.

The Launcher can be access through an instance of TopLevel or Window, for more details on accessing TopLevel please visit TopLevel page:

var launcher = TopLevel.GetTopLevel(control).Launcher;

Methods

LaunchUriAsync

Starts the default app associated with the URI scheme name for the specified URI.

Task<bool> LaunchUriAsync(Uri uri)
примечание

Input URI can have any scheme including custom ones. But it's up to the Operating System to accept or deny this launcher request.

LaunchFileAsync

Starts the default app associated with the specified storage file or folder.

Task<bool> LaunchFileAsync(IStorageItem storageItem);
примечание

IStorageItem is a file or folder retrieved from sandboxed APIs such as IStorageProvider or IClipboard. If you only target non-sandboxed desktop platforms, consider using extension methods accepting FileInfo or DirectoryInfo.

Extension Methods

LaunchFileInfoAsync

Starts the default app associated with the specified storage file.

Task<bool> LaunchFileInfoAsync(FileInfo fileInfo)

LaunchFileAsync

Starts the default app associated with the specified storage directory (folder).

Task<bool> LaunchDirectoryInfoAsync(DirectoryInfo directoryInfo);
примечание

Each of these methods returns a boolean result indicating whether OS can handle request or not. It does not guarantee, that there is an app than can handle launcher request.

Platform compatibility:

FeatureWindowsmacOSLinuxBrowserAndroidiOSTizen
LaunchUriAsync
LaunchFileAsync
LaunchFileInfoAsync
LaunchDirectoryInfoAsync