StartupTaskActivatedEventArgs 类

定义

提供在设备启动或用户登录时激活应用时的信息。

public ref class StartupTaskActivatedEventArgs sealed : IActivatedEventArgsWithUser, IStartupTaskActivatedEventArgs
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 327680)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class StartupTaskActivatedEventArgs final : IActivatedEventArgsWithUser, IStartupTaskActivatedEventArgs
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 327680)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class StartupTaskActivatedEventArgs : IActivatedEventArgsWithUser, IStartupTaskActivatedEventArgs
Public NotInheritable Class StartupTaskActivatedEventArgs
Implements IActivatedEventArgsWithUser, IStartupTaskActivatedEventArgs
继承
Object Platform::Object IInspectable StartupTaskActivatedEventArgs
属性
实现

Windows 要求

设备系列
Windows 10 Fall Creators Update (在 10.0.16299.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v5.0 中引入)

示例

protected override void OnActivated(IActivatedEventArgs args)
{
    string argString = string.Empty;

    // Existing behavior to differentiate different activation kinds,
    // and to extract any argument payload.
    switch (args.Kind)
    {
        case ActivationKind.StartupTask:
            var startupArgs = args as StartupTaskActivatedEventArgs;
            string taskId = startupArgs.TaskId;
            break;
    }
}

注解

此功能仅在 Windows 桌面上受支持。

属性

Kind

获取激活此应用的原因。

PreviousExecutionState

获取激活前的应用的执行状态。

SplashScreen

获取一个 SplashScreen 对象,该对象提供有关从初始屏幕到激活的应用的转换的信息。

TaskId

获取任务的唯一标识符。

User

获取为其激活应用的用户。

适用于

另请参阅