locked
How could I judge an app is minimized or not?

    Question

  • How could I judge an app is minimized or not, thanks.

    Tuesday, April 24, 2012 3:16 AM

Answers

  • No, not really.  There is a way to tell if your page is visible or not (HTML5 dom feature).  Why do you need to know this in your application?  Perhaps there is a better way.

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, April 24, 2012 12:47 PM
    Moderator

All replies

  • Metro-style apps don't necessarily go to a "minimized" state, but are in one of three states: running, suspended and not running. And there are 4 transition states you can listen for: suspending, resuming, terminating and activating. This is very well documented in this blog post:

    http://blogs.msdn.com/b/windowsappdev/archive/2012/04/10/managing-app-lifecycle-so-your-apps-feel-quot-always-alive-quot.aspx

    Todd

    Tuesday, April 24, 2012 6:21 AM
  • Metro-style apps don't necessarily go to a "minimized" state, but are in one of three states: running, suspended and not running. And there are 4 transition states you can listen for: suspending, resuming, terminating and activating. This is very well documented in this blog post:

    http://blogs.msdn.com/b/windowsappdev/archive/2012/04/10/managing-app-lifecycle-so-your-apps-feel-quot-always-alive-quot.aspx

    Todd


    Hi Todd,

       Thank you very much. The docs says "Windows waits for a few seconds to allow quick switching back to the app, then tries to suspend the app." I just want to judge the state of the app when it is switched out but not suspended. Is there a way to realize? Thanks.

    Pan

    Tuesday, April 24, 2012 8:29 AM
  • No, not really.  There is a way to tell if your page is visible or not (HTML5 dom feature).  Why do you need to know this in your application?  Perhaps there is a better way.

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, April 24, 2012 12:47 PM
    Moderator
  • No, not really.  There is a way to tell if your page is visible or not (HTML5 dom feature).  Why do you need to know this in your application?  Perhaps there is a better way.

    -Jeff


    Jeff Sanders (MSFT)


    Thanks Jeff, I try to work on a file download app, and when the file downloads ready,  and if the app is visible, directly open it. If not, show a toast.
    Wednesday, April 25, 2012 3:07 AM
  • Is the download happening from a background worker in your app?

    Jeff Sanders (MSFT)

    Wednesday, April 25, 2012 12:17 PM
    Moderator
  • Is the download happening from a background worker in your app?

    Jeff Sanders (MSFT)


    Thanks Jeff, my download is happenning for a background worker.
    Thursday, April 26, 2012 2:28 AM
  • You cannot get the UI state of your app from the background worker so you will not be able to do this.  I recommend providing the toast and syncing the complete status in the app so you have both scenarios covered.

    -Jeff


    Jeff Sanders (MSFT)


    Thursday, April 26, 2012 3:53 PM
    Moderator
  • OK, Thank you very much.
    Friday, April 27, 2012 7:21 AM