SystemTrigger class

This topic has not yet been rated - Rate this topic

Represents a system event that triggers a background task to run.

Syntax


var systemTrigger = new Windows.ApplicationModel.Background.SystemTrigger();

Attributes

ActivatableAttribute(Windows.ApplicationModel.Background.ISystemTriggerFactory, NTDDI_WIN8)
MarshalingBehaviorAttribute(Standard)
ThreadingAttribute(MTA)
VersionAttribute(NTDDI_WIN8)

Members

The SystemTrigger class has these types of members:

Constructors

The SystemTrigger class has these constructors.

ConstructorDescription
SystemTrigger Initializes a new instance of a system event trigger.

 

Methods

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

Properties

The SystemTrigger class has these properties.

PropertyAccess typeDescription

OneShot

Read-onlyGets whether a system event trigger will be used only once.

TriggerType

Read-onlyGets the system event type of a system event trigger.

 

Remarks

Note  : This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).

Examples

The following example shows how to create and register a system trigger with the TimeZoneChanged event.


//
// A friendly task name.
//
String name = "ExampleTaskName";

//
// Must be the same entry point that is specified in the manifest.
//
String taskEntryPoint = "ExampleNamespace.ExampleTaskName";

//
// A system trigger that goes off whenever the time zone is changed, or a change occurs with daylight savings time.
//
IBackgroundTrigger trigger = new SystemTrigger(SystemTriggerType.TimeZoneChange, false);

//
// Builds the background task.
//
BackgroundTaskBuilder builder = new BackgroundTaskBuilder();

builder.Name = name;
builder.TaskEntryPoint = taskEntryPoint;
builder.SetTrigger(trigger);

//
// Registers the background task, and get back a BackgroundTaskRegistration object representing the registered task.
//
BackgroundTaskRegistration task = builder.Register();

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Namespace

Windows.ApplicationModel.Background
Windows::ApplicationModel::Background [C++]

Metadata

Windows.winmd

 

 

Build date: 12/4/2012

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.