コード例 #1
0
 public static void Show(Notification notification)
 {
     if (_currentNotification != null && _currentNotification.Priority != -1 && _currentNotification.Priority >= notification.Priority)
         _backlog.Enqueue(notification);
     else
         ShowNotification(notification);
 }
コード例 #2
0
        public static void Show(string title, string text, Action clicked = null, int priority = 0)
        {
            var notification = new Notification
            {
                Title = title,
                Text = text,
                Clicked = clicked,
                Priority = priority
            };

            Show(notification);
        }
コード例 #3
0
        private static void ShowNotification(Notification notification)
        {
            _notifyIcon.Visible = false;
            Notification peeked;
            if (_backlog.TryPeek(out peeked) && peeked == notification)
                _backlog.TryDequeue(out peeked);

            _currentNotification = notification;

            _notifyIcon.Visible = true;
            _notifyIcon.BalloonTipTitle = notification.Title;
            _notifyIcon.BalloonTipText = notification.Text;
            _notifyIcon.ShowBalloonTip(500);
        }
コード例 #4
0
        private static void OnBalloonClosed(object sender, EventArgs eventArgs)
        {
            _currentNotification = null;

            if (_backlog.IsEmpty)
                return;

            Notification notification;
            if (!_backlog.TryDequeue(out notification))
                return;

            ShowNotification(notification);
        }