private void NotificationsForm_Load(object sender, EventArgs e) { foreach(ArchivedNotification notification in ArchivedNotifications.Instance.Queue) { var itemWrapper = new ArchivedNotificationListItemWrapper(notification); this.listViewNotifications.Items.Add(itemWrapper); this.SetNotificationIcon(itemWrapper); // set the item's icon. } }
private void SetNotificationIcon(ArchivedNotificationListItemWrapper listItem) { if (!listItem.Notification.Item.GetType().IsSubclassOf(typeof (ModuleNode))) return; var item = (ModuleNode)listItem.Notification.Item; if (item.Icon == null) return; // if item doesn't have an assosiciated icon, just ignore. if (!this.ImageList.Images.ContainsKey(item.Icon.Key)) this.ImageList.Images.Add(item.Icon.Key, item.Icon.Image); // add the icon to imagelist if doesnt exists yet. listItem.ImageKey = item.Icon.Key; }