Example #1
0
        public void AddAnnouncement(Announcement announcement)
        {
            Announcements.Add(announcement);

            if (Announcements.Count > MaxAnnouncements)
            {
                Announcement toRemove = Announcements.ElementAt(0);
                Announcements.RemoveAt(0);
                OnRemoved(toRemove);
            }

            OnAdded(announcement);

            if (Announcements.Count > 25)
            {
                Announcements.RemoveAt(0);
            }
        }
 void Manager_OnRemoved(Announcement announcement)
 {
 }
Example #3
0
 protected virtual void OnOnRemoved(Announcement announcement)
 {
     AnnouncementRemoved handler = OnRemoved;
     if (handler != null) handler(announcement);
 }
Example #4
0
        public void Announce(string title, string message, Announcement.Clicked clickAction = null)
        {
            Announcement toAdd = new Announcement
            {
                Color = Color.Black,
                Icon = null,
                Message = message,
                Name = title
            };

            if (clickAction != null)
            {
                toAdd.OnClicked += clickAction;
            }

            AddAnnouncement(toAdd);
        }
Example #5
0
            public void SetAnnouncement(Announcement announcement)
            {
                AnnouncementColor = announcement.Color;
                ToolTip = announcement.Message;
                Text = announcement.Name;
                TextColor = announcement.Color;

                OnClicked += announcement.ActivateClick;
            }
Example #6
0
 void Manager_OnRemoved(Announcement announcement)
 {
 }
Example #7
0
        void Manager_OnAdded(Announcement announcement)
        {
            AnnouncementView view = new AnnouncementView(GUI, this);
            AnnouncementViews.Insert(0, view);
            view.SetAnnouncement(announcement);

            if (AnnouncementViews.Count > MaxViews)
            {
                AnnouncementView oldView = AnnouncementViews.ElementAt(AnnouncementViews.Count - 1);
                RemoveChild(oldView);
                AnnouncementViews.RemoveAt(AnnouncementViews.Count - 1);
            }

            WaitTimer.Reset(5);
            UpdateLayout();
        }