Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在UWP/C中获取Windows 10?通知的内容?_C#_Uwp_Notifications_Windows 10 - Fatal编程技术网

C# 如何在UWP/C中获取Windows 10?通知的内容?

C# 如何在UWP/C中获取Windows 10?通知的内容?,c#,uwp,notifications,windows-10,C#,Uwp,Notifications,Windows 10,我试图获取用户通知中的文本,以及单击通知时发生的操作。我获得用户读取它们的权限(使用UserNotificationListener.RequestAccessAsync()),然后迭代它们,并将它们添加到ListView: private async void getNotificationsAsync() { UserNotificationListener listener = UserNotificationListener.Current; IReadOnlyList&

我试图获取用户通知中的文本,以及单击通知时发生的操作。我获得用户读取它们的权限(使用
UserNotificationListener.RequestAccessAsync()
),然后迭代它们,并将它们添加到ListView:

private async void getNotificationsAsync()
{
    UserNotificationListener listener = UserNotificationListener.Current;
    IReadOnlyList<UserNotification> notifs = await listener.GetNotificationsAsync(NotificationKinds.Toast);
    NotificationsList.Items.Clear();
    foreach (UserNotification notif in notifs)
    {
        //Console.WriteLine(notif.AppInfo.DisplayInfo.DisplayName);
        NotificationsList.Items.Add(notif.AppInfo.DisplayInfo.DisplayName);
    }
}
private async void getNotificationsAsync()
{
UserNotificationListener=UserNotificationListener.Current;
IReadOnlyList notifs=wait listener.GetNotificationsAsync(NotificationKinds.Toast);
NotificationsList.Items.Clear();
foreach(通知中的用户通知notif)
{
//Console.WriteLine(notif.AppInfo.DisplayInfo.DisplayName);
NotificationsList.Items.Add(notif.AppInfo.DisplayInfo.DisplayName);
}
}
但是,我只能从中获得启动应用程序的名称(以及通知发生的时间)。在
UserNotification
类中,我找不到访问通知内容的任何方法

我所尝试的可能吗?我使用的是正确的类吗

找到了!(总是发生在我问这个问题之后)找到了!(总是发生在我问这个问题之后