and other non-critical processing
Turning off the music is a key feature of your app, and therefore is a critical processing.
That said, since the DispatcherTimer has a strong dependance on the UI, I don't know if it will run properly under the lock screen. You should use a classical timer instead, or even better, just a thread with a Thread.Sleep
instruction.
For instance, if you must stop the music two hours after the screen is locked, start a thread in the Obscured
event and make it sleep for two hours:
private void TurnOffMusic()
{
Thread.Sleep(1000 * 60 * 60 * 2); // Sleep for two hours
// Turn off the music
}