CoreApplication.LeavingBackground 事件

定義

在應用程式 UI 變成可見之前引發。

// Register
static event_token LeavingBackground(EventHandler<LeavingBackgroundEventArgs> const& handler) const;

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

// Revoke with event_revoker
static CoreApplication::LeavingBackground_revoker LeavingBackground(auto_revoke_t, EventHandler<LeavingBackgroundEventArgs> const& handler) const;
public static event System.EventHandler<LeavingBackgroundEventArgs> LeavingBackground;
function onLeavingBackground(eventArgs) { /* Your code */ }
Windows.ApplicationModel.Core.CoreApplication.addEventListener("leavingbackground", onLeavingBackground);
Windows.ApplicationModel.Core.CoreApplication.removeEventListener("leavingbackground", onLeavingBackground);
- or -
Windows.ApplicationModel.Core.CoreApplication.onleavingbackground = onLeavingBackground;
Public Shared Custom Event LeavingBackground As EventHandler(Of LeavingBackgroundEventArgs) 

事件類型

Windows 需求

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

備註

先前載入 UI 的最佳位置是在啟動或繼續事件處理常式中。 現在,LeavingBackground 事件的處理常式是執行最終檢查的最佳位置,以確保 UI 已準備好呈現。 請務必檢查視覺資產此時是否已準備好,因為在讓使用者看見您的應用程式之前,這是最後一個可執行工作的機會。

適用於

另請參閱