ToastNotification.Dismissed Событие

Определение

Происходит, когда всплывающее уведомление покидает экран по истечении срока действия или явно закрывается пользователем. Приложения, которые выполняются, подписываются на это событие.

// Register
event_token Dismissed(TypedEventHandler<ToastNotification, ToastDismissedEventArgs const&> const& handler) const;

// Revoke with event_token
void Dismissed(event_token const* cookie) const;

// Revoke with event_revoker
ToastNotification::Dismissed_revoker Dismissed(auto_revoke_t, TypedEventHandler<ToastNotification, ToastDismissedEventArgs const&> const& handler) const;
public event TypedEventHandler<ToastNotification,ToastDismissedEventArgs> Dismissed;
function onDismissed(eventArgs) { /* Your code */ }
toastNotification.addEventListener("dismissed", onDismissed);
toastNotification.removeEventListener("dismissed", onDismissed);
- or -
toastNotification.ondismissed = onDismissed;
Public Custom Event Dismissed As TypedEventHandler(Of ToastNotification, ToastDismissedEventArgs) 

Тип события

Примеры

В следующем примере показано, как прослушивать и обрабатывать событие Dismissed.

var notifications = Windows.UI.Notifications;

yourToastNotification.addEventListener("dismissed", function (e) {
    switch (e.reason) {
        case notifications.ToastDismissalReason.applicationHidden:
            // The application hid the toast using ToastNotifier.hide.
            break;
        case notifications.ToastDismissalReason.userCanceled:
            // The user dismissed the toast.
            break;
        case notifications.ToastDismissalReason.timedOut:
            // The toast has expired.
            break;
    }
}

Комментарии

ToastDismissalReason включен в параметр ToastDismissedEventArgs.

Применяется к

См. также раздел