private async void SaveImage(object sender, MotionResult e) { if (await ShouldSendNotification(e.Difference)) { MotionDetectorFactory.SaveImage(); Debug.WriteLine("Image Captured"); } ; }
private void SendNotification(object sender, MotionResult e) => new Task(async() => { if (await ShouldSendNotification(e.Difference)) { //big movement occured SubscribeNotificationData.sendNotificationToAll(); MotionDetectorFactory.ImageCaptured -= SendNotification; Task.Delay(5000).Wait(); MotionDetectorFactory.ImageCaptured += SendNotification; } }).Start();
private async void UpdateUI(object sender, MotionResult e) { UpdatePrevToResult(e.Image); ShowMessage(e.Difference.ToString()); CaptureImage(); await runOnUIThread(() => { if (e.Difference > NotificationAt.Value) { NotificationControl.Background = new SolidColorBrush(Color.FromArgb(255, 244, 217, 66)); } else { NotificationControl.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)); } }); }