Defines the content, associated metadata and events, and expiration time of a toast notification.
PlatformVersion supported AndroidAndroid 4.4 and later iOSiOS 9.0 and later Windows UWPWindows 10 Windows StoreWindows 8.1 or later Windows Phone StoreWindows Phone 8.1 or later Windows Phone SilverlightWindows Phone 8.1 or later
Exemple #1
0
        /// <summary>
        /// Hides a toast notification.
        /// </summary>
        /// <param name="notification">The object that supplies the new XML definition for the toast.</param>
        public void Hide(ToastNotification notification)
        {
#if __IOS__
            UIApplication.SharedApplication.InvokeOnMainThread(() =>
            {
                UIApplication.SharedApplication.CancelLocalNotification(notification._localNotification);
            });
#elif WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP || WINDOWS_PHONE_81
            _notifier.Hide(notification._notification);
#else
            throw new PlatformNotSupportedException();
#endif
        }
Exemple #2
0
        /// <summary>
        /// Shows a toast notification.
        /// </summary>
        /// <param name="notification">The object that supplies the new XML definition for the toast.</param>
        public void Show(ToastNotification notification)
        {
#if __ANDROID__
            notification._toast.Show();
#elif __IOS__
            UIApplication.SharedApplication.InvokeOnMainThread(() =>
            {
                UIApplication.SharedApplication.PresentLocalNotificationNow(notification._localNotification);
            });
#elif TIZEN
            Tizen.Applications.Notifications.NotificationManager.PostToastMessage(notification.Title + "\r\n" + notification.Content);
#elif WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP || WINDOWS_PHONE_81
            _notifier.Show(notification._notification);
#elif WINDOWS_PHONE
            notification._shellToast.Show();
#endif
        }