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) { }
protected virtual void OnOnRemoved(Announcement announcement) { AnnouncementRemoved handler = OnRemoved; if (handler != null) handler(announcement); }
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); }
public void SetAnnouncement(Announcement announcement) { AnnouncementColor = announcement.Color; ToolTip = announcement.Message; Text = announcement.Name; TextColor = announcement.Color; OnClicked += announcement.ActivateClick; }
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(); }