Detect Alarm Reject at Application Launch?

I created an application with a toggle switch that tells the user that the alarm is scheduled.

If my application closes when the alarm goes off and the user clicks “Dismiss” and then launches my application, I can detect that the alarm has expired through ScheduledActionService.Find and set the switch to the “off” position.

The problem that I encountered is when my application is open and the alarm goes off. In this case, when the user clicks the “Disable” button and returns to my application, which was in the background, how to detect the change in the alarm state?

Is there an event that I can listen to when the alarm is off? If not, is there a way to detect when my application loses / gains focus due to alarm dialogue?

thank

+3
source share
1 answer

Inside, App.Xaml.csyou can subscribe to events Obscuredand Unobscuredyour RootFrame.

    RootFrame.Obscured += new EventHandler<ObscuredEventArgs>(RootFrame_Obscured);
    RootFrame.Unobscured += new EventHandler(RootFrame_Unobscured);

When an alarm occurs it RootFrame_Unobscuredwill start; after rejection, RootFrame_Obscuredwill be launched.

0
source

All Articles