3
votes

I'm working on a WP8.1 Silverlight app with background tasks (these are the new WinPRT tasks). I want the background task which is launched from a TimeTrigger to behave differently depending on whether the user is present or not. So, my question is - is there any way to check this from the background task?

I know I could register two tasks with SystemCondition UserPresent/Away, but I was wondering if there's a better way to do it. After all I want the task to execute every time, just do some things a little differently.

1

1 Answers

2
votes

I found the solution. There's this property of the type SystemProtection:

// Gets a value that indicates whether the screen is locked.
public static bool ScreenLocked { get; }

It seems to be working and doing exactly what I need.