locked
Event to capture on load of app RRS feed

  • Question

  • Hi,

    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.

    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.

    Thanks,

    Neena

    Thursday, September 27, 2012 12:20 PM

All replies

  • 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


    Jeff Sanders (MSFT)

    Thursday, September 27, 2012 1:28 PM
    Moderator
  • Thanks.

    This event is triggered if the user closes the app (Alt+F4) and opens again. But if we just swap and come back, and open the app the event needs to be triggered. Is that possible?

    Regards,

    Neena

    Friday, September 28, 2012 4:06 AM
  • It will help me answer your problem is you can tell me why do you need this information in your app? 

    Jeff Sanders (MSFT)

    Friday, September 28, 2012 11:58 AM
    Moderator
  • In the app I need to get mails updated each time the user opens the app. i.e.  A snyc should happen between the server side and client side when the user opens the app.


    • Edited by Neena IS Saturday, September 29, 2012 7:16 AM
    Saturday, September 29, 2012 5:57 AM