FileActivatedEventArgs 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
public ref class FileActivatedEventArgs sealed : IApplicationViewActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
public ref class FileActivatedEventArgs sealed : IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class FileActivatedEventArgs final : IApplicationViewActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class FileActivatedEventArgs final : IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class FileActivatedEventArgs : IApplicationViewActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class FileActivatedEventArgs : IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
Public NotInheritable Class FileActivatedEventArgs
Implements IApplicationViewActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
Public NotInheritable Class FileActivatedEventArgs
Implements IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IFileActivatedEventArgsWithCallerPackageFamilyName, IFileActivatedEventArgsWithNeighboringFiles, IViewSwitcherProvider
- 继承
- 属性
- 实现
Windows 要求
设备系列 |
Windows 10 (在 10.0.10240.0 中引入)
|
API contract |
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)
|
示例
Application 对象上的 OnFileActivated 事件处理程序接收所有文件激活事件。
protected override void OnFileActivated(FileActivatedEventArgs args)
{
// TODO: Handle file activation
// The number of files received is args.Files.Size
// The first file is args.Files[0].Name
}
Private Sub OnFileActivated(ByVal args As Windows.ApplicationModel.Activation.FileActivatedEventArgs)
' TODO: Handle file activation
' The number of files received is args.Files.Size
' The first file is args.Files(0).Name
End Sub
void App::OnFileActivated(Windows::ApplicationModel::Activation::FileActivatedEventArgs const& /* args */)
{
// TODO: Handle file activation.
// The number of files received is args.Files().Size().
// The first file is args.Files().GetAt(0).Name().
}
void App::OnFileActivated(Windows::ApplicationModel::Activation::FileActivatedEventArgs^ args)
{
// TODO: Handle file activation
// The number of files received is args->Files->Size
// The first file is args->Files->GetAt(0)->Name
}
注解
当 ActivationKind 为 File 时,实现事件处理程序以响应 Activated 事件时,将访问此对象。
使用 C++、C# 或 Visual Basic 的 UWP 应用通常通过重写 Application 对象的方法来实现激活点。 默认模板 app.xaml 代码隐藏文件始终包含 OnLaunched 的替代,但为其他激活点(如 OnFileActivated )定义替代取决于应用代码。
激活方案涉及的所有 应用程序 替代都应在其实现中调用 Window.Activate 。
请注意,为文件协定激活应用时,必须使用通过 Files 属性传递给应用的 StorageFile 对象访问数据。 不应尝试访问文件的路径,因为你的应用可能没有对文件位置的权限。
版本历史记录
Windows 版本 | SDK 版本 | 已添加值 |
---|---|---|
1607 | 14393 | User |
属性
CallerPackageFamilyName |
启动应用的包系列名称。 |
CurrentlyShownApplicationViewId |
获取当前显示的应用视图的标识符。 |
Files |
获取为其激活应用的文件。 |
Kind |
获取激活类型。 |
NeighboringFilesQuery |
获取激活应用的文件的相邻文件。 |
PreviousExecutionState |
获取应用在激活前的执行状态。 |
SplashScreen |
获取初始屏幕对象,该对象提供有关从初始屏幕过渡到激活的应用的信息。 |
User |
获取为其激活应用的用户。 |
Verb |
获取与激活的文件关联的操作。 |
ViewSwitcher |
提供对象,该对象允许你为应用程序设置视图。 |