private async void Button_Click(object sender, RoutedEventArgs e)
        {
            Debug.Write("button pressed");
            MediaElement mediaElement = new MediaElement();

            // Get the listener

            UserNotificationListenerAccessStatus accessStatus =
                await listener.RequestAccessAsync();

            if (accessStatus != UserNotificationListenerAccessStatus.Allowed)
            {
                return;
            }

            // Get the toast notifications
            NotificationsProcessor.GetNotificationsAndProcessThem();
            //Request / check background task access via BackgroundExecutionManager.RequestAccessAsync
            var requestStatus =
                await Windows.ApplicationModel.Background.BackgroundExecutionManager.RequestAccessAsync();

            if (requestStatus != BackgroundAccessStatus.AlwaysAllowed)
            {
            }


            ApplicationData.Current.LocalSettings.Values["python"]  = this.PythonPath.Text;
            ApplicationData.Current.LocalSettings.Values["command"] = this.NotificationPath.Text;
            // If background task isn't registered yet
            if (!BackgroundTaskRegistration.AllTasks.
                Any(i => i.Value.Name.Equals("UserNotificationChanged")))
            {
                // Specify the background task
                var builder = new BackgroundTaskBuilder()
                {
                    Name = "UserNotificationChanged"
                };

                // Set the trigger for Listener, listening to Toast Notifications
                builder.SetTrigger(new UserNotificationChangedTrigger(NotificationKinds.Toast));

                // Register the task
                builder.Register();
            }
            button.IsEnabled = false;
            Python.IsEnabled = false;
            NotificationPythonFile.IsEnabled = false;
        }
        protected override async void OnBackgroundActivated(BackgroundActivatedEventArgs args)
        {
            var deferral = args.TaskInstance.GetDeferral();

            switch (args.TaskInstance.Task.Name)
            {
            case "UserNotificationChanged":
                // Call your own method to process the new/removed notifications
                // The next section of documentation discusses this code
                await NotificationsProcessor.SyncNotifications();

                break;
            }

            deferral.Complete();
        }
 internal static async Task SyncNotifications()
 {
     NotificationsProcessor.GetNotificationsAndProcessThem();
 }