問題描述
我從 Windows 8.1 開始使用桌面應用程序的 toast 通知,但使用 Windows 10 中的新操作中心,我遇到了一些意外行為.
I used the toast notifications for desktop app since Windows 8.1 but with the new action center in Windows 10, I am experiencing some unexpected behaviours.
當用戶對 Toast 不做任何操作時,它會直接消失而無需進入操作中心(ToastNotification.Dismissed
是 ToastDismissalReason.TimedOut
).我不知道這是否與我在 win32 應用程序中使用它有關,但 Windows 通用應用程序中的相同 toast 在超時時進入操作中心.
When the user do nothing with the toast, it simply disappear without going to the action center (ToastNotification.Dismissed
is ToastDismissalReason.TimedOut
). I don't know if it related to the fact that I use it in a win32 app but the same toast in a Windows Universal App goes to the action center when it timed out.
需要注意的一點是我沒有注冊 AppUserModelID 對于我在 W8.1 中需要的 win32 應用程序,它似乎不再是強制性的.我仍然用注冊的 id 測試,我也有同樣的問題.
One thing to note is that I have not registered an AppUserModelID for my win32 app like it was needed in W8.1, it seems to not be mandatory anymore. I still tested with a registered id, and I had the same popblem.
那么,我怎樣才能防止 toast 在超時時不進入操作中心?
So, how can i prevent the toast from not going in the action center when it timed out ?
這是重現問題的極簡代碼(控制臺應用程序):
Here is a minimalist code (console app) that reproduces the issue :
感謝您的幫助.
我在 涵蓋該主題的 msdn 博客文章,我得到確認,它應該在超時時保留在操作中心,并且它可能是一個錯誤.
Edit : I posted this bug on the msdn blog post that cover the subject and I got the confirmation that it should remain in the action center when timed out and that it might be a bug.
推薦答案
Win32 應用程序需要設置 COM 服務器才能在操作中心持久化 toast:http://blogs.msdn.com/b/tiles_and_toasts/archive/2015/10/15/quickstart-handling-toast-activations-from-win32-apps-in-windows-10.aspx
Win32 apps need to set up a COM server in order to have toasts persisted in Action Center: http://blogs.msdn.com/b/tiles_and_toasts/archive/2015/10/15/quickstart-handling-toast-activations-from-win32-apps-in-windows-10.aspx
這篇關于來自 Windows 10 桌面應用程序的吐司通知中的意外行為的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!