Example #1
0
        public void Dispose()
        {
            if (IsDisposed)
            {
                return;
            }

            Notifications.Clear();
            _buffer.Clear();

            OnDispose.InvokeSafely(this, new EventArgs());

            IsDisposed = true;
            GC.SuppressFinalize(this);
        }
Example #2
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);
        }