locked
Detecting inactivity in single app mode RRS feed

  • Question

  • Does anyone have any idea how do i implement it?

    it says here that time out is not supported in single app mode
    Monday, February 8, 2010 9:15 AM

Answers

  • icube, without trying to implement this myself I wouldn't be able to tell you which one is going to work better for you. However, I believe that the DispatcherTimer is more popular.
    Josh Curry (jcurry) | Sr. Support Escalation Engineer | Microsoft Surface Support
    • Proposed as answer by Ben Tousey Monday, February 15, 2010 6:19 PM
    • Marked as answer by Ben Tousey Wednesday, February 17, 2010 7:25 PM
    Wednesday, February 10, 2010 9:26 PM

All replies

  • icube, the inactivity timer was designed as a way for the Surface Shell to shut down all running applications, start a new session, and return to the Attract application. Knowing that, you might see why that behavior doesn't really make sense if you are using Single App Mode. bYou would be restarting the same application and nothing would really change.

    If you really want to restart your application after an idle period you might want to look into using a timer to detect that and restarting it programatically, or having it go back to the start screen, etc...


    Josh Curry (jcurry) | Sr. Support Escalation Engineer | Microsoft Surface Support
    Monday, February 8, 2010 7:53 PM
  • Hi, thanks for the feedback...

    For our requirement, we would require a log in after an inactivity period. Therefore would like to implement this feature.

    I tried the code at http://www.codeproject.com/KB/WPF/AutologoffWPF.aspx but to no avail since surface input is not based on OS messages right?

    Therefore I'm looking for some starting place/suggestions to correctly implement this feature.

    Thanks.
    Tuesday, February 9, 2010 2:22 AM
  • icube, I think I understand what you are trying to do. You are correct that the Contact events are not based on OS messages and that would explain why that code doesn't work for what you are trying to do.

    A very basic implementation of what you are trying to do might be to just add a PreviewContactDown handler to the SurfaceWindow. That way you can reset the timer anytime someone touches the Surface top. If the timer ever ticks you do whatever your app needs to do to reset the session and go back to the login screen.


    Josh Curry (jcurry) | Sr. Support Escalation Engineer | Microsoft Surface Support
    Tuesday, February 9, 2010 8:56 PM
  • Do you recommend the DispatcherTimer or Timer from the Forms namespace?
    Wednesday, February 10, 2010 3:14 AM
  • icube, without trying to implement this myself I wouldn't be able to tell you which one is going to work better for you. However, I believe that the DispatcherTimer is more popular.
    Josh Curry (jcurry) | Sr. Support Escalation Engineer | Microsoft Surface Support
    • Proposed as answer by Ben Tousey Monday, February 15, 2010 6:19 PM
    • Marked as answer by Ben Tousey Wednesday, February 17, 2010 7:25 PM
    Wednesday, February 10, 2010 9:26 PM