語言

CoreApplication.BackgroundActivated 活動

定義

當背景觸發程式啟動您的應用程式時引發。

// Register
static event_token BackgroundActivated(EventHandler<BackgroundActivatedEventArgs> const& handler) const;

// Revoke with event_token
static void BackgroundActivated(event_token const* cookie) const;

// Revoke with event_revoker
static CoreApplication::BackgroundActivated_revoker BackgroundActivated(auto_revoke_t, EventHandler<BackgroundActivatedEventArgs> const& handler) const;
public static event System.EventHandler<BackgroundActivatedEventArgs> BackgroundActivated;
function onBackgroundActivated(eventArgs) { /* Your code */ }
Windows.ApplicationModel.Core.CoreApplication.addEventListener("backgroundactivated", onBackgroundActivated);
Windows.ApplicationModel.Core.CoreApplication.removeEventListener("backgroundactivated", onBackgroundActivated);
- or -
Windows.ApplicationModel.Core.CoreApplication.onbackgroundactivated = onBackgroundActivated;
Public Shared Custom Event BackgroundActivated As EventHandler(Of BackgroundActivatedEventArgs) 

事件類型

Windows 需求

規格需求 Description
裝置系列
Windows 10 Anniversary Edition (已於 10.0.14393.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v3.0 引進)

備註

向 BackgroundTaskBuilder註冊背景觸發程式,但未設定 TaskEntryPoint。 這可讓您在觸發程式收到訊號時引發此事件。 事件處理常式具有 BackgroundActivatedEventArgs 參數,其中包含 IBackgroundTask.Run 方法所提供的一切。

提示

當應用程式進入背景狀態時,不會顯示其 UI。

適用於

另請參閱