public void Run(IBackgroundTaskInstance taskInstance) { // Defer task instance in order to keep this task running deferral = taskInstance.GetDeferral(); taskInstance.Canceled += TaskInstanceCanceled; motionDetector = new PassiveInfraredMotionDetector(26, 500); motionDetector.Initialize(); themeNotification = new SeinfeldThemeNotification(); motionDetector.MotionDetected += MotionDetectorMotionDetectedAsync; }
public void Run(IBackgroundTaskInstance taskInstance) { // Defer task instance in order to keep this task running deferral = taskInstance.GetDeferral(); taskInstance.Canceled += TaskInstanceCanceled; motionDetector = new PassiveInfraredMotionDetector(26, 500); motionDetector.Initialize(); lightsNotification = new HueLightsNotification("[Your app key goes here]"); lightsNotification.InitializeAsync() .Wait(); motionDetector.MotionDetected += MotionDetectorMotionDetectedAsync; }