Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/281.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# 删除ToastNotificationManager中的所有通知_C#_Windows Phone 8.1_Windows 8.1_Windows 10_Toast - Fatal编程技术网

C# 删除ToastNotificationManager中的所有通知

C# 删除ToastNotificationManager中的所有通知,c#,windows-phone-8.1,windows-8.1,windows-10,toast,C#,Windows Phone 8.1,Windows 8.1,Windows 10,Toast,我有这个密码 public void RemoveExistingToastNotifications() { var TNM = ToastNotificationManager.CreateToastNotifier(); var notifications = TNM.GetScheduledToastNotifications(); for (int i = 0; i < notifications.Count; i

我有这个密码

    public void RemoveExistingToastNotifications()
    {
        var TNM = ToastNotificationManager.CreateToastNotifier();
        var notifications = TNM.GetScheduledToastNotifications();

        for (int i = 0; i < notifications.Count; i++)
        {
            TNM.RemoveFromSchedule(notifications[i]);
        }
    }

它工作得很好,但值得注意的是,这种方法的性能不是很好。对于Windows系统8.1及更高版本,有没有更好更快的方法来删除所有通知?

没有其他API可以一次删除所有通知。我建议您提交一个请求来请求这个新功能。

使用xperf/WPA来跟踪哪个代码部分比较慢:,我按照您的建议做了。