Search code examples
c#windows-8windows-8.1tablet

What event tells me when the tablet has been unlocked?


I'm using Windows 8.1 on a tablet device (ASUS ME400). I wanted to attach an event handler to an event that tells me when the screen comes on and I log into the desktop. Since the session has a 15 minute timeout, it doesn't always lock. So basically what I am looking for is an event that is raised when the user arrives at the desktop. I've tried the following but it did not work:

SystemEvents.SessionSwitch += (sender, e) => {
    m_logger.InfoFormat
        ("Session Switch event raised. Forcing background update.");
};

Solution

  • First of all, there is appearently no option to attach such event handler for detection of lock screen arrival.

    You'd like to run a background service that's working even if your app is suspended. You may find all possible things with a background agent in the following, they are all defined as enums: http://msdn.microsoft.com/en-us/library/windows/apps/br229873.aspx