public void RemoveNotification(Notification notification)
        {
            lock (lockObject)
            {
                if (Notifications.Contains(notification))
                {
                    Notifications.Remove(notification);
                }

                if (buffer.Count > 0)
                {
                    Notifications.Add(buffer[0]);
                    buffer.RemoveAt(0);
                }

                if (Notifications.Count > 0)
                {
                    BeginStoryboard();
                }
                //关闭
                if (Notifications.Count < 1)
                {
                    Hide();
                }
            }
        }
示例#2
0
        public void AddNotification(string caption, string message, string details, MessageType type)
        {
            Notification not = new Notification();

            not.Header  = caption;
            not.Message = message;
            not.Type    = type;
            not.Details = details;
            if (!Notifications.Contains(not))
            {
                Notifications.Add(not);
            }
            OnNotificationsUpdated();
        }
示例#3
0
 /// <summary>
 /// Removes a notification from the queue, clearing it.
 /// </summary>
 /// <param name="notification">Notification to remove.</param>
 public void RemoveNotification(Notification notification)
 {
     if (Notifications.Contains(notification))
     {
         Notifications.Remove(notification);
     }
     if (buffer.Count > 0)
     {
         Notifications.Add(buffer[0]);
         buffer.RemoveAt(0);
     }
     //Close window if there's nothing to show
     if (Notifications.Count < 1)
     {
         this.Visibility = System.Windows.Visibility.Collapsed;
     }
 }
        public void RemoveNotification(Notification notification)
        {
            if (notifications.Contains(notification))
            {
                notifications.Remove(notification);
            }

            if (buffer.Count > 0)
            {
                notifications.Add(buffer[0]);
                buffer.RemoveAt(0);
            }

            //Close window if there's nothing to show
            if (notifications.Count < 1)
            {
                Hide();
            }
        }
示例#5
0
        /// <summary>
        /// 移除通知
        /// </summary>
        /// <param name="notification"></param>
        public void RemoveNotify(Notification notification)
        {
            if (notifications.Contains(notification))
            {
                notifications.Remove(notification);
            }

            if (bufferNotifications.Count > 0)
            {
                notifications.Add(bufferNotifications[0]);
                bufferNotifications.RemoveAt(0);
            }

            //如果当前没什么通知需要显示,就把通知窗口关上
            if (notifications.Count < 1)
            {
                Hide();
            }
        }
示例#6
0
        public void RemoveNotification(Notification notification)
        {
            if (Notifications.Contains(notification))
            {
                Notifications.Remove(notification);
            }
            if (buffer.Count <= 0)
            {
                return;
            }
            Notifications.Add(buffer[0]);
            buffer.RemoveAt(0);

            //Close window if there's nothing to show
            if (Notifications.Count < 1 && IsActive)
            {
                Close();
            }
        }
        public void RemoveNotification(NotificationBase notification)
        {
            if (!Dispatcher.CheckAccess())
            {
                Dispatcher.Invoke(new Action(() => RemoveNotification(notification)));
                return;
            }
            if (Notifications.Contains(notification))
            {
                Notifications.Remove(notification);
            }

            if (buffer.Count > 0)
            {
                Notifications.Add(buffer[0]);
                buffer.RemoveAt(0);
            }

            //Close window if there's nothing to show
            Resize();
        }
        public void RemoveNotification(Notification notification)
        {
            if (Notifications.Contains(notification))
            {
                Notifications.Remove(notification);
            }

            if (buffer.Count > 0)
            {
                Notifications.Add(buffer[0]);
                buffer.RemoveAt(0);
                //MessageBox.Show("sound 1");
                mediaElement_done.Stop();
                mediaElement_done.Play();
            }

            //Close window if there's nothing to show
            if (Notifications.Count < 1)
            {
                Hide();
            }
        }
示例#9
0
        public void RemoveNotification(Notification notification)
        {
            Dispatcher.InvokeAsync(
                () =>
            {
                if (Notifications.Contains(notification))
                {
                    Notifications.Remove(notification);
                }

                if (_buffer.Count > 0)
                {
                    Notifications.Add(_buffer[0]);
                    _buffer.RemoveAt(0);
                }

                if (Notifications.Count < 1)
                {
                    Hide();
                    OnDispose.InvokeSafely(this, new EventArgs());
                }
            },
                DispatcherPriority.Background);
        }