Application.EnteredBackground 事件

定义

当应用从前台移动到背景时发生。

public:
 virtual event EnteredBackgroundEventHandler ^ EnteredBackground;
// Register
event_token EnteredBackground(EnteredBackgroundEventHandler const& handler) const;

// Revoke with event_token
void EnteredBackground(event_token const* cookie) const;

// Revoke with event_revoker
Application::EnteredBackground_revoker EnteredBackground(auto_revoke_t, EnteredBackgroundEventHandler const& handler) const;
public event EnteredBackgroundEventHandler EnteredBackground;
function onEnteredBackground(eventArgs) { /* Your code */ }
application.addEventListener("enteredbackground", onEnteredBackground);
application.removeEventListener("enteredbackground", onEnteredBackground);
- or -
application.onenteredbackground = onEnteredBackground;
Public Custom Event EnteredBackground As EnteredBackgroundEventHandler 

事件类型

EnteredBackgroundEventHandler

Windows 要求

设备系列
Windows 10 Anniversary Edition (在 10.0.14393.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v3.0 中引入)

注解

当用户离开应用时会触发此事件。 此事件的事件处理程序可以运行有限的时间。

当应用进入后台时,由系统强制执行的内存约束可能会更改。 使用此事件检查当前内存消耗和释放资源,以便保持低于限制,以便应用不会暂停,并且可能在后台终止。 有关更多详细信息 ,请参阅应用移动到后台时的可用内存

EnteredBackground 事件在注册到的公寓中运行。

适用于

另请参阅