Represents a time event that triggers a background task to run.
Syntax
var timeTrigger = new Windows.ApplicationModel.Background.TimeTrigger();
Attributes
- ActivatableAttribute(Windows.ApplicationModel.Background.ITimeTriggerFactory, NTDDI_WIN8)
- MarshalingBehaviorAttribute(Standard)
- ThreadingAttribute(MTA)
- VersionAttribute(NTDDI_WIN8)
Members
The TimeTrigger class has these types of members:
Constructors
The TimeTrigger class has these constructors.
| Constructor | Description |
|---|---|
| TimeTrigger | Initializes a new instance of a time event trigger. |
Methods
The TimeTrigger class inherits methods from the Object class (C#/VB/C++).
Properties
The TimeTrigger class has these properties.
| Property | Access type | Description |
|---|---|---|
| Read-only | Gets the interval of a time event trigger. | |
| Read-only | Gets whether the time event trigger will be used only once or each time the FreshnessTime interval elapses. |
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 time trigger. Note that your app must be placed on the lock screen, and the background task must be declared in the manifest, before the registration can be successful.
// // A friendly task name. // String name = "ExampleTaskName"; // // Must be the same entry point that is specified in the manifest. // String taskEntryPoint = "ExampleNamespace.ExampleTaskName"; // // A time trigger that repeats at 15-minute intervals. // IBackgroundTrigger trigger = new TimeTrigger(15, 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 |
|
|
Metadata |
|
Build date: 12/4/2012