Example #1
0
        /// <summary>
        /// Gets all notifications by id for given type.
        /// </summary>
        /// <param name="type">The type of notification.</param>
        /// <returns>List of ids</returns>
        public List <int> GetIdsByType(Notification.Type type)
        {
            var ids = new List <int>();

            if (type == Notification.Type.All || type == Notification.Type.Scheduled)
            {
                var toasts = ToastNotifier.GetScheduledToastNotifications();

                foreach (var toast in toasts)
                {
                    if (!this.IsPhantom(toast))
                    {
                        ids.Add(int.Parse(toast.Tag));
                    }
                }
            }

            if (type == Notification.Type.All || type == Notification.Type.Triggered)
            {
                var toasts = ToastNotificationManager.History.GetHistory();

                foreach (var toast in toasts)
                {
                    if (!this.IsPhantom(toast))
                    {
                        ids.Add(int.Parse(toast.Tag));
                    }
                }
            }

            return(ids);
        }
Example #2
0
 public NotificationView(Notification.Type type, Decoration decoration, uint icon, string text)
 {
     Type       = type;
     Decoration = decoration;
     Icon       = icon;
     Text       = text;
 }
Example #3
0
        /// <summary>
        /// Gets all notifications of given type.
        /// </summary>
        /// <param name="type">The type of notification.</param>
        /// <returns>A list of notifications.</returns>
        public List <Notification> GetByType(Notification.Type type)
        {
            var notifications = new List <Notification>();

            if (type == Notification.Type.All || type == Notification.Type.Scheduled)
            {
                var toasts = ToastNotifier.GetScheduledToastNotifications();

                foreach (var toast in toasts)
                {
                    if (!this.IsPhantom(toast))
                    {
                        notifications.Add(new Notification(toast));
                    }
                }
            }

            if (type == Notification.Type.All || type == Notification.Type.Triggered)
            {
                var toasts = ToastNotificationManager.History.GetHistory();

                foreach (var toast in toasts)
                {
                    if (!this.IsPhantom(toast))
                    {
                        notifications.Add(new Notification(toast));
                    }
                }
            }

            return(notifications);
        }
Example #4
0
    public void Unsubscribe(Notification.Type type, Notifiable notifiable)
    {
        if (!m_types.ContainsKey(type))
        {
            return;
        }

        List <Notifiable> notifiables = m_types[type];

        notifiables.Remove(notifiable);
    }
Example #5
0
        /// <summary>
        /// Gets all notifications for given type.
        /// </summary>
        /// <param name="type">The type of notification.</param>
        /// <returns>A list of notification options instances.</returns>
        public List <Options> GetOptionsByType(Notification.Type type)
        {
            var options = new List <Options>();
            var toasts  = this.GetByType(type);

            foreach (var toast in toasts)
            {
                options.Add(toast.Options);
            }

            return(options);
        }
Example #6
0
    // PUBLIC METHODS
    // -------------------------------------------------------------------------

    public void Subscribe(Notification.Type type, INotificationListener listener)
    {
        if (!m_types.ContainsKey(type))
        {
            m_types[type] = new List <INotificationListener>();
        }

        if (!m_types[type].Contains(listener))
        {
            m_types[type].Add(listener);
        }
    }
        public async Task SendNotification(ApplicationUser user, Notification.Type type, DateTime time)
        {
            var newNotification = new Notification
            {
                NotificationType = type,
                Date             = time,
                UserId           = user.Id
            };

            _context.Notification.Add(newNotification);
            await _context.SaveChangesAsync();
        }
Example #8
0
    public void Unsubscribe(Notification.Type type, INotificationListener listener)
    {
        if (!m_types.ContainsKey(type))
        {
            return;
        }

        if (!m_types[type].Contains(listener))
        {
            return;
        }

        m_types[type].Remove(listener);
    }
Example #9
0
    public void Notify(Notification notification)
    {
        Notification.Type type = notification.type;

        if (!m_types.ContainsKey(type))
        {
            return;
        }

        List <Notifiable> notifiables = m_types[type];

        foreach (Notifiable notifiable in notifiables)
        {
            notifiable.OnNotification(notification, this);
        }
    }
Example #10
0
    // PUBLIC METHODS
    // -------------------------------------------------------------------------

    public void Subscribe(Notification.Type type, Notifiable notifiable)
    {
        if (!m_types.ContainsKey(type))
        {
            m_types[type] = new List <Notifiable>();
        }

        List <Notifiable> notifiables = m_types[type];

        if (notifiables.Contains(notifiable))
        {
            return;
        }

        notifiables.Add(notifiable);
    }
    public void AddNotification(Notification.Type type, string text)
    {
        if (notifications.Count >= NumRows)
        {
            RemoveOldest();
        }

        // Spawn note just to the left
        Notification note = Instantiate(NotificationPrefab, new Vector2(RowPositions[0].x - 100, RowPositions[0].y), new Quaternion(0, 0, 0, 0));

        note.MyParent = this;
        note.UpdateType(type);
        note.UpdateText(text);
        note.life    = 60 * 6;
        note.maxFade = 60 * 5;
        note.curFade = 60 * 5;
        note.started = true;

        notifications.Insert(0, note);
        note.transform.SetParent(PanelObj.transform, false);
    }
        public static void Show(string Message, Notification.Type type)
        {
            Notification not = new Notification();

            not.Popup(Message, type);
        }