在app加载时捕获的事件 [英] Event to capture on load of app
问题描述
我想在每次点击瓷砖时打开应用时捕获事件。更具体地说,每次用户打开应用程序时,我都需要进行服务器调用以进行更新。
I would like to capture the event each time the app is opened when we click on the tile. To be more specific, I need to make a server call to be updated each time a user opens the app.
例如:在Mail应用程序中,如果收到新邮件通知,收件箱将使用列表中的最新邮件进行刷新,则需要执行类似的操作。
For e.g.: In the Mail app, if a new mail notification comes the Inbox refreshes with the latest mail in the listing., something similar needs to be achieved.
谢谢,
Neena
推荐答案
创建一个应用程序在Visual Studio中,您将看到此事件:
Create an application in Visual Studio, you will see this event:
app.onactivated = function (args) {
if (args.detail.kind === activation.ActivationKind.launch) {
if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) {
// TODO: This application has been newly launched. Initialize
// your application here.
} else {
// TODO: This application has been reactivated from suspension.
// Restore application state here.
}
args.setPromise(WinJS.UI.processAll().then(function () {
// attach event handler to your title here for click
}));
此外,您还可以附加一个事件处理程序来响应标题/标题对象的点击。
Also in there you can attach an event handler to respond to the header / title object click.
-Jeff
这篇关于在app加载时捕获的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!