Windows Dev Center

LauncherOptions class

Specifies the options used to launch the default app for a file or URI.

Syntax


var launcherOptions = new Windows.System.LauncherOptions();

Members

The LauncherOptions class has these types of members:

Constructors

The LauncherOptions class has these constructors.

ConstructorDescription
LauncherOptions Creates and initializes a new instance of the launcher options object.

 

Properties

The LauncherOptions class has these properties.

PropertyAccess typeDescription

ContentType

Read/writeGets or sets the content type that is associated with a URI that represents a file on the network.

DesiredRemainingView

Read/writeLaunch a target app and have the currently running source app remain on the screen by sharing the space equally with the target app or by taking up more or less space than the target app.

DisplayApplicationPicker

Read/writeGets or sets a value that indicates whether to display the Open With dialog whenever the association launching API is called.

FallbackUri

Read/writeGets or sets a value that represents a URI that the user should be taken to in the browser if no app exists to handle the file type or URI.

NeighboringFilesQuery

Read/writeEnables an app to access files that are related to the file used to activate the app.

PreferredApplicationDisplayName

Read/writeGets or sets a value that represents the display name of the app in the store that the user should install if no app exists to handle the file type or URI.

PreferredApplicationPackageFamilyName

Read/writeGets or sets a value that represents the package family name of the app in the Store that the user should install if no app exists to handle the file type or URI.

TargetApplicationPackageFamilyName

Read/writeThe package family name of the target package that should be used to launch a file or URI. This property is optional.

TreatAsUntrusted

Read/writeGets or sets a value that indicates whether the system should display a warning that the file or URI is potentially unsafe when starting the app associated with a file or URI.

UI

Read-onlyGets the user interface (UI) options when starting a default app.

 

Examples

Call the Launcher.LaunchFileAsync(IStorageFile, LauncherOptions) | launchFileAsync(IStorageFile, LauncherOptions) method with LauncherOptions.DisplayApplicationPicker | displayApplicationPicker set to true to launch the app that the user selects for the file from the Open With dialog box.



// Path to the file in the app package to launch
var imageFile = "images\\test.png";

// Get the image file from the package's image directory
Windows.ApplicationModel.Package.current.installedLocation.getFileAsync(imageFile).then(
  function (file) {
    // Set the show picker option
    var options = new Windows.System.LauncherOptions();
    options.displayApplicationPicker = true;

    // Launch the retrieved file using the selected app
    Windows.System.Launcher.launchFileAsync(file, options).then(
      function (success) {
        if (success) {
            // File launched
        } else {
            // File launch failed
        }
      });
  });

Requirements (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.System
Windows::System [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.System
Windows::System [C++]

Metadata

Windows.winmd

Attributes

[MarshalingBehavior(Agile)]
[Version(0x06020000)]

See also

Object
Samples
Association launching sample
Tasks
How to launch the default app for a file (JavaScript)
Launch the default app for a file
How to launch the default app for a URI (JavaScript)
Launch the default app for a URI
Guidelines
Guidelines and checklist for file types and URIs
Reference
Launcher.LaunchFileAsync(IStorageFile, LauncherOptions)
Launcher.LaunchUriAsync(Uri, LauncherOptions)

 

 

Show:
© 2015 Microsoft