LauncherOptions class

Applies to Windows and Windows Phone

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

Syntax


public ref class LauncherOptions sealed 

Attributes

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

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.

 

Methods

The LauncherOptions class inherits methods from the Object class (C#/VB/C++).

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.

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.

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.


void MainPage::DefaultLaunch()
{
   auto installFolder = Windows::ApplicationModel::Package::Current->InstalledLocation;

   concurrency::task<Windows::Storage::StorageFile^> getFileOperation(installFolder->GetFileAsync("images\\test.png"));
   getFileOperation.then([](Windows::Storage::StorageFile^ file)
   {
      if (file != nullptr)
      {
         // Set the option to show the picker
         auto launchOptions = ref new Windows::System::LauncherOptions();
         launchOptions->DisplayApplicationPicker = true;

         // Launch the retrieved file
         concurrency::task<bool> launchFileOperation(Windows::System::Launcher::LaunchFileAsync(file, launchOptions));
         launchFileOperation.then([](bool success)
         {
            if (success)
            {
               // File launched
            }
            else
            {
               // File launch failed
            }
         });
      }
      else
      {
         // Could not find file
      }
   });
}

Requirements

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

See also

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

 

 

Show:
© 2014 Microsoft