private void SendRecentShoutsToFacade(IEnumerable <TraktActivity.Activity> activities) { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); // protected profiles might return null if (activities == null || activities.Count() == 0) { GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.UserHasNoRecentShouts); PreviousUser = CurrentUser; CurrentUser = TraktSettings.Username; GUIWindowManager.ShowPreviousWindow(); return; } int itemId = 0; var shoutImages = new List <TraktImage>(); // Add each item added foreach (var activity in activities) { // bad api data if (activity.Movie == null && activity.Show == null) { continue; } var item = new GUICustomListItem(GUICommon.GetActivityListItemTitle(activity), (int)TraktGUIWindows.RecentShouts); // add images for download var images = new TraktImage { ShowImages = activity.Show != null ? activity.Show.Images : null, MovieImages = activity.Movie != null ? activity.Movie.Images : null }; shoutImages.Add(images); // add user shout date as second label item.Label2 = activity.Timestamp.FromEpoch().ToShortDateString(); item.TVTag = activity; item.Images = images; item.ItemId = Int32.MaxValue - itemId; item.IconImage = GUIImageHandler.GetDefaultPoster(false); item.IconImageBig = GUIImageHandler.GetDefaultPoster(); item.ThumbnailImage = GUIImageHandler.GetDefaultPoster(); item.PinImage = "traktActivityShout.png"; item.OnItemSelected += OnShoutSelected; Utils.SetDefaultIcons(item); Facade.Add(item); itemId++; } // set Facade Layout Facade.SetCurrentLayout("List"); GUIControl.FocusControl(GetID, Facade.GetID); if (PreviousSelectedIndex >= activities.Count()) { Facade.SelectIndex(PreviousSelectedIndex - 1); } else { Facade.SelectIndex(PreviousSelectedIndex); } // set facade properties GUIUtils.SetProperty("#itemcount", activities.Count().ToString()); GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", activities.Count().ToString(), activities.Count() > 1 ? Translation.Shout : Translation.Shouts)); // Download images Async and set to facade GUICustomListItem.GetImages(shoutImages); }