2016-02-05 35 views
0

我正在使用Windows 8中的ToastNotification對象,它們工作正常。Windows 8中的C#ToastNotification。ExpirationTime不起作用

似乎有問題的唯一屬性是應設置消息消失的時刻(如果未被用戶單擊)的ExpirationTime。

ToastNotification toast = new ToastNotification(toastXml); 

toast.ExpirationTime = DateTimeOffset.Now.AddDays(1); ; 
toast.Activated += ToastActivated; 
toast.Dismissed += ToastDismissed; 

ToastNotificationManager.CreateToastNotifier(APP_ID).Show(toast); 

我都試過,以及在我職位的代碼的例子:

toast.ExpirationTime = System.DateTime.Today.AddDays(1) 
toast.ExpirationTime = new DateTimeOffset(DateTime.Now.AddDays(1)); 

但它不工作。 Toast消息正確顯示,但幾秒鐘後消失。

我在做什麼錯了?

回答

1

我找到了自己的問題的答案。 我發佈了它,將來可能對某人有用。

enter image description here

真正ExpirationTime採用的是設置好的在PC設置「顯示通知」。 您在代碼中設置的ExpirationTime不能超過此值。