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;
    }
}

注釈

ToastDismissalReasonToastDismissedEventArgs パラメーターに含まれています。

適用対象

こちらもご覧ください