Edit

Share via


BackgroundTaskHelper.Register Method

Definition

Overloads

Register(String, IBackgroundTrigger, Boolean, Boolean, IBackgroundCondition[])

Registers under the Single Process Model. WARNING: Single Process Model only works with Windows 10 Anniversary Update (14393) and later. Registers a background task with conditions. If the task is already registered and has the same trigger, returns the existing registration if it has the same trigger. If the task is already registered but has different trigger, return null by default. Or set forceRegister to true to un-register the old one and then re-register.

Register(Type, IBackgroundTrigger, Boolean, Boolean, IBackgroundCondition[])

Registers a background task with conditions. If the task is already registered and has the same trigger, returns the existing registration if it has the same trigger. If the task is already registered but has different trigger, return null by default. Or set forceRegister to true to un-register the old one and then re-register.

Register(String, String, IBackgroundTrigger, Boolean, Boolean, IBackgroundCondition[])

Registers a background task with conditions. If the task is already registered, return null. Or set forceRegister to true to un-register the old one and then re-register.

Register(String, IBackgroundTrigger, Boolean, Boolean, IBackgroundCondition[])

Source:
BackgroundTaskHelper.cs
Source:
BackgroundTaskHelper.cs
Source:
BackgroundTaskHelper.cs

Registers under the Single Process Model. WARNING: Single Process Model only works with Windows 10 Anniversary Update (14393) and later. Registers a background task with conditions. If the task is already registered and has the same trigger, returns the existing registration if it has the same trigger. If the task is already registered but has different trigger, return null by default. Or set forceRegister to true to un-register the old one and then re-register.

public static Windows.ApplicationModel.Background.BackgroundTaskRegistration Register(string backgroundTaskName, Windows.ApplicationModel.Background.IBackgroundTrigger trigger, bool forceRegister = false, bool enforceConditions = true, params Windows.ApplicationModel.Background.IBackgroundCondition[] conditions);
static member Register : string * Windows.ApplicationModel.Background.IBackgroundTrigger * bool * bool * Windows.ApplicationModel.Background.IBackgroundCondition[] -> Windows.ApplicationModel.Background.BackgroundTaskRegistration
Public Shared Function Register (backgroundTaskName As String, trigger As IBackgroundTrigger, Optional forceRegister As Boolean = false, Optional enforceConditions As Boolean = true, ParamArray conditions As IBackgroundCondition()) As BackgroundTaskRegistration

Parameters

backgroundTaskName
String

The name of the background task class

trigger
Windows.ApplicationModel.Background.IBackgroundTrigger

Trigger that indicate when the background task should be invoked

forceRegister
Boolean

Indicate if the background task will be force installed in the case of being already registered

enforceConditions
Boolean

Indicate if the background task should quit if condition is no longer valid

conditions
Windows.ApplicationModel.Background.IBackgroundCondition[]

Optional conditions for the background task to run with

Returns

Windows.ApplicationModel.Background.BackgroundTaskRegistration

Background Task that was registered with the system

Applies to

Register(Type, IBackgroundTrigger, Boolean, Boolean, IBackgroundCondition[])

Source:
BackgroundTaskHelper.cs
Source:
BackgroundTaskHelper.cs
Source:
BackgroundTaskHelper.cs

Registers a background task with conditions. If the task is already registered and has the same trigger, returns the existing registration if it has the same trigger. If the task is already registered but has different trigger, return null by default. Or set forceRegister to true to un-register the old one and then re-register.

public static Windows.ApplicationModel.Background.BackgroundTaskRegistration Register(Type backgroundTaskType, Windows.ApplicationModel.Background.IBackgroundTrigger trigger, bool forceRegister = false, bool enforceConditions = true, params Windows.ApplicationModel.Background.IBackgroundCondition[] conditions);
static member Register : Type * Windows.ApplicationModel.Background.IBackgroundTrigger * bool * bool * Windows.ApplicationModel.Background.IBackgroundCondition[] -> Windows.ApplicationModel.Background.BackgroundTaskRegistration
Public Shared Function Register (backgroundTaskType As Type, trigger As IBackgroundTrigger, Optional forceRegister As Boolean = false, Optional enforceConditions As Boolean = true, ParamArray conditions As IBackgroundCondition()) As BackgroundTaskRegistration

Parameters

backgroundTaskType
Type

The type of the background task. This class has to implement IBackgroundTask

trigger
Windows.ApplicationModel.Background.IBackgroundTrigger

Trigger that indicate when the background task should be invoked

forceRegister
Boolean

Indicate if the background task will be force installed in the case of being already registered

enforceConditions
Boolean

Indicate if the background task should quit if condition is no longer valid

conditions
Windows.ApplicationModel.Background.IBackgroundCondition[]

Optional conditions for the background task to run with

Returns

Windows.ApplicationModel.Background.BackgroundTaskRegistration

Background Task that was registered with the system

Applies to

Register(String, String, IBackgroundTrigger, Boolean, Boolean, IBackgroundCondition[])

Source:
BackgroundTaskHelper.cs
Source:
BackgroundTaskHelper.cs
Source:
BackgroundTaskHelper.cs

Registers a background task with conditions. If the task is already registered, return null. Or set forceRegister to true to un-register the old one and then re-register.

public static Windows.ApplicationModel.Background.BackgroundTaskRegistration Register(string backgroundTaskName, string backgroundTaskEntryPoint, Windows.ApplicationModel.Background.IBackgroundTrigger trigger, bool forceRegister = false, bool enforceConditions = true, params Windows.ApplicationModel.Background.IBackgroundCondition[] conditions);
static member Register : string * string * Windows.ApplicationModel.Background.IBackgroundTrigger * bool * bool * Windows.ApplicationModel.Background.IBackgroundCondition[] -> Windows.ApplicationModel.Background.BackgroundTaskRegistration
Public Shared Function Register (backgroundTaskName As String, backgroundTaskEntryPoint As String, trigger As IBackgroundTrigger, Optional forceRegister As Boolean = false, Optional enforceConditions As Boolean = true, ParamArray conditions As IBackgroundCondition()) As BackgroundTaskRegistration

Parameters

backgroundTaskName
String

Name of the background task class

backgroundTaskEntryPoint
String

Entry point of the background task.

trigger
Windows.ApplicationModel.Background.IBackgroundTrigger

Trigger that indicate when the background task should be invoked

forceRegister
Boolean

Indicate if the background task will be force installed in the case of being already registered

enforceConditions
Boolean

Indicate if the background task should quit if condition is no longer valid

conditions
Windows.ApplicationModel.Background.IBackgroundCondition[]

Optional conditions for the background task to run with

Returns

Windows.ApplicationModel.Background.BackgroundTaskRegistration

Background Task that was registered with the system

Applies to