private void PushForce(NotificationContent notification)
        {
            var window = new PopupNotificationForm(notification);
            var h      = window.Height;
            var x      = _origin.X;
            var y      = _origin.Y - h;

            window.Left = x;
            window.Top  = y;
            _windows.Add(window);
            MakeRoomInStack(window);
            window.SizeChanged += OnWindowSizeChanged;
            AnimateFadeIn(window);
            window.Closed += OnWindowClosed;
            window.Show();
        }
        public void PushNotification(NotificationContent content)
        {
            Verify.Argument.IsNotNull(content, nameof(content));
            if (IsDisposed)
            {
                throw new ObjectDisposedException(GetType().Name);
            }

            if (_windows.Count < MaximumVisibleNotifications)
            {
                PushForce(content);
            }
            else
            {
                _queue.Enqueue(content);
            }
        }
Beispiel #3
0
        public PopupNotificationForm(NotificationContent content)
        {
            if (content == null)
            {
                throw new ArgumentNullException("content");
            }

            _content        = content;
            Text            = content.Text;
            Font            = GitterApplication.FontManager.UIFont;
            BackColor       = GitterApplication.Style.ViewRenderer.BackgroundColor;
            FormBorderStyle = FormBorderStyle.None;
            StartPosition   = FormStartPosition.Manual;
            Padding         = new Padding(Renderer.FloatBorderSize);
            ShowInTaskbar   = false;
            ShowIcon        = false;
            ControlBox      = false;
            MinimizeBox     = false;
            MaximizeBox     = true;
            TopMost         = true;

            var header = new PopupNotificationHeader()
            {
                Text   = content.Text,
                Bounds = new Rectangle(
                    Renderer.FloatBorderSize,
                    Renderer.FloatBorderSize,
                    ViewConstants.PopupWidth - Renderer.FloatBorderSize * 2,
                    ViewManager.Renderer.HeaderHeight),
                Parent = this,
            };

            var cr = ClientRectangle;

            content.Width  = ViewConstants.PopupWidth - Renderer.FloatBorderSize * 2;
            content.Top    = cr.Top + ViewManager.Renderer.HeaderHeight + Renderer.FloatBorderSize;
            ClientSize     = new Size(ViewConstants.PopupWidth, content.Height + Renderer.HeaderHeight + Renderer.FloatBorderSize * 2);
            content.Left   = Renderer.FloatBorderSize;
            content.Parent = this;

            AssignEventHandlers(this);
        }
        public void PushNotification(NotificationContent content)
        {
            if (content == null)
            {
                throw new ArgumentNullException("content");
            }
            if (IsDisposed)
            {
                throw new ObjectDisposedException(GetType().Name);
            }

            if (_windows.Count < MaximumVisibleNotifications)
            {
                PushForce(content);
            }
            else
            {
                _queue.Enqueue(content);
            }
        }