导出 (0) 打印
全部展开
信息
您所需的主题如下所示。但此主题未包含在此库中。

LauncherOptions Class

指定用于启动文件或 URI 的默认应用程序的选项。

语法


Public NotInheritable Class LauncherOptions

特性

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

成员

LauncherOptions类 具有这些类型的成员:

构造函数

LauncherOptions类 具有这些构造函数。

构造函数说明
LauncherOptions Creates and initializes a new instance of the launcher options object.

 

方法

The LauncherOptions 类 继承这些方法于:Object 类 (C#/VB/C++).

属性

LauncherOptions类 具有这些属性。

属性访问类型说明

ContentType

读/写Gets or sets the content type that is associated with a URI that represents a file on the network.

DesiredRemainingView

读/写Launch 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

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

FallbackUri

读/写Gets 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

读/写Gets 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

读/写Gets 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

读/写Gets 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

只读Gets the user interface (UI) options when starting a default app.

 

备注

Windows Phone 8

此 API 不实现,但是调用时会引发异常。请参见 Windows Phone 运行时 API

示例

调用 Launcher.LaunchFileAsync(IStorageFile, LauncherOptions) | launchFileAsync(IStorageFile, LauncherOptions) 方法,同时将 LauncherOptions.DisplayApplicationPicker | displayApplicationPicker 设置为 true,以便启动用户从“打开方式”对话框中为该文件选择的应用程序。


async Sub DefaultLaunch()

   ' Path to the file in the app package to launch
   Dim imageFile = "images\test.png"

   Dim file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(imageFile)

   If file IsNot Nothing Then
      ' Set the option to show the picker
      Dim options = Windows.System.LauncherOptions()
      options.DisplayApplicationPicker = True

      ' Launch the retrieved file
      Dim success = await Windows.System.Launcher.LaunchFileAsync(file, options)

      If success Then
         ' File launched
      Else
         ' File launch failed
      End If
   Else
      ' Could not find file
   End If
End Sub

要求

最低支持客户端

Windows 8 [仅 Windows 应用商店应用程序]

最低支持服务器

Windows Server 2012 [仅 Windows 应用商店应用程序]

最低支持电话

Windows Phone 8 [未实现,请参见备注]

命名空间

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

元数据

Windows.winmd

另请参见

示例
关联启动示例
任务
如何启动文件的默认应用程序 (JavaScript)
如何启动文件的默认应用程序 (C#/VB/C++)
如何启动 URI 的默认应用程序 (JavaScript)
如何启动 URI 的默认应用程序 (C#/VB/C++)
准则
文件类型和 URI 的指南和检查表
引用
Launcher.LaunchFileAsync(IStorageFile, LauncherOptions)
Launcher.LaunchUriAsync(Uri, LauncherOptions)

 

 

显示:
© 2014 Microsoft