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 已准备好进行演示的最佳位置。 请务必在此时检查可视化资源是否已准备就绪,因为这是应用程序对用户可见之前执行此操作的最后机会。

适用于

另请参阅