locked
Detect Windows 8.1 Application Idle Time or System Idle Time.

    Question

  • I want to develop an application which locks itself after some time interval.

    Although there are ways to detect idle time in application but I couldn't get something regarding getting Application Idle Time or System's Idle Time anyone will do.

    Thanks

    Abhishek

    Monday, August 18, 2014 12:30 PM

Answers

  • Hi Abhishekk,

    I think you may ref to a thread: http://stackoverflow.com/questions/17027352/detect-how-long-a-user-has-been-inactive-within-a-windows-8-store-app-or-system

    What he did is to monitor a keyboard event and a mouse event, I think you could do the same for your purpose, currently there is no such API for you to directly get a idel time spent by your app. 

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, August 29, 2014 11:06 AM
    Moderator
  • I think there is a way easier way.   

    Start a DispatcherTimer to tick at your lock interval at page load.  Let's say you want it to lock at 10 minutes. Set the timer.Interval = Timespan.FromMinutes(10);

    In the _Tick event handler for the timer, do the logic to have the user re-login.


    Darin R.

    Tuesday, September 9, 2014 12:24 AM

All replies

  • Do you want to know the actual user set time for system Idle time?

    Information about Idle detection is available in the following link.

    http://msdn.microsoft.com/en-us/library/windows/apps/ff941090(v=vs.105).aspx

    Monday, August 18, 2014 7:15 PM
    Moderator
  • Thanks rashmi for your reply. 

    But my main problem is that i want to know the idle time spent by my app in the foreground. The link you provided me is about windows phone app and i am working on windows RT(8.1) store apps.

    Could you please help me regarding that?

    Thanks

    Abhishek

    Tuesday, August 19, 2014 5:08 AM
  • Hi Abhishekk,

    I think you may ref to a thread: http://stackoverflow.com/questions/17027352/detect-how-long-a-user-has-been-inactive-within-a-windows-8-store-app-or-system

    What he did is to monitor a keyboard event and a mouse event, I think you could do the same for your purpose, currently there is no such API for you to directly get a idel time spent by your app. 

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, August 29, 2014 11:06 AM
    Moderator
  • I think there is a way easier way.   

    Start a DispatcherTimer to tick at your lock interval at page load.  Let's say you want it to lock at 10 minutes. Set the timer.Interval = Timespan.FromMinutes(10);

    In the _Tick event handler for the timer, do the logic to have the user re-login.


    Darin R.

    Tuesday, September 9, 2014 12:24 AM