Пример #1
0
        public void AddNotification(string id, string text, Action clickHandler, string informationUrl = "")
        {
            NotificationControl notificationControl;

            foreach (Control control in containerPanel.Controls)
            {
                notificationControl = (NotificationControl)control;
                if ((string)notificationControl.Tag == id)
                    return;
            }

            notificationControl = new NotificationControl(text, clickHandler, (nc) => {
                nc.Parent = null;
                if (NotificationsChanged != null)
                    NotificationsChanged(this);
            }, informationUrl);

            notificationControl.Height = 28;
            notificationControl.Parent = containerPanel;
            notificationControl.Top = Int16.MaxValue;
            notificationControl.Tag = (object)id;

            notificationControl.BringToFront();

            notificationControl.Dock = DockStyle.Top;

            containerPanel.ScrollControlIntoView(notificationControl);

            if (NotificationAdded != null)
                NotificationAdded(text);

            if (NotificationsChanged != null)
                NotificationsChanged(this);
        }
Пример #2
0
        public void AddNotification(string id, string text, Action clickHandler, string informationUrl = "")
        {
            NotificationControl notificationControl;

            foreach (Control control in containerPanel.Controls)
            {
                notificationControl = (NotificationControl)control;
                if ((string)notificationControl.Tag == id)
                {
                    return;
                }
            }

            notificationControl = new NotificationControl(text, clickHandler, (nc) => {
                nc.Parent = null;
                if (NotificationsChanged != null)
                {
                    NotificationsChanged(this);
                }
            }, informationUrl);

            notificationControl.Height = 28;
            notificationControl.Parent = containerPanel;
            notificationControl.Top    = Int16.MaxValue;
            notificationControl.Tag    = (object)id;

            notificationControl.BringToFront();

            notificationControl.Dock = DockStyle.Top;

            containerPanel.ScrollControlIntoView(notificationControl);

            if (NotificationAdded != null)
            {
                NotificationAdded(text);
            }

            if (NotificationsChanged != null)
            {
                NotificationsChanged(this);
            }
        }