private void SendShoutsToFacade(IEnumerable <TraktShout> shouts) { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); if (shouts == null || shouts.Count() == 0) { if (shouts != null) { string title = string.Empty; switch (ShoutType) { case ShoutTypeEnum.movie: title = MovieInfo.Title; break; case ShoutTypeEnum.show: title = ShowInfo.Title; break; case ShoutTypeEnum.episode: title = string.Format(EpisodeInfo.ToString()); break; } ClearProperties(); GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), string.Format(Translation.NoShoutsForItem, title)); } if (ExitIfNoShoutsFound) { GUIWindowManager.ShowPreviousWindow(); return; } } GUIUtils.SetProperty("#itemcount", shouts.Count().ToString()); GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", shouts.Count(), shouts.Count() > 1 ? Translation.Shouts : Translation.Shout)); int id = 0; List <TraktUser> users = new List <TraktUser>(); // Add each user that shouted to the list foreach (var shout in shouts) { GUITraktShoutListItem shoutItem = new GUITraktShoutListItem(shout.User.Username); shoutItem.Label2 = shout.InsertedDate.FromEpoch().ToShortDateString(); shoutItem.Item = shout.User; shoutItem.TVTag = shout; shoutItem.ItemId = id++; shoutItem.IconImage = "defaultTraktUser.png"; shoutItem.IconImageBig = "defaultTraktUserBig.png"; shoutItem.ThumbnailImage = "defaultTraktUserBig.png"; shoutItem.OnItemSelected += OnShoutSelected; Utils.SetDefaultIcons(shoutItem); Facade.Add(shoutItem); users.Add(shout.User); } // Enable / Disable GUI Controls EnableGUIButtons(); // Set Facade Layout if (Facade.Count > 0) { Facade.SetCurrentLayout("List"); GUIControl.FocusControl(GetID, Facade.GetID); Facade.SelectedListItemIndex = 0; } else { GUIControl.FocusControl(GetID, nextEpisodeButton.GetID); } // Download avatars Async and set to facade GetImages(users); }
private void SendShoutsToFacade(IEnumerable<TraktShout> shouts) { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); if (shouts == null || shouts.Count() == 0) { if (shouts != null) { string title = string.Empty; switch (ShoutType) { case ShoutTypeEnum.movie: title = MovieInfo.Title; break; case ShoutTypeEnum.show: title = ShowInfo.Title; break; case ShoutTypeEnum.episode: title = string.Format(EpisodeInfo.ToString()); break; } GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), string.Format(Translation.NoShoutsForItem, title)); } GUIWindowManager.ShowPreviousWindow(); return; } GUIUtils.SetProperty("#itemcount", shouts.Count().ToString()); GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", shouts.Count(), shouts.Count() > 1 ? Translation.Shouts : Translation.Shout)); int id = 0; List<TraktShout.TraktUser> users = new List<TraktShout.TraktUser>(); // Add each user that shouted to the list foreach (var shout in shouts) { GUITraktShoutListItem shoutItem = new GUITraktShoutListItem(shout.User.Username); shoutItem.Label2 = shout.InsertedDate.FromEpoch().ToShortDateString(); shoutItem.Item = shout.User; shoutItem.TVTag = shout; shoutItem.ItemId = id++; shoutItem.IconImage = "defaultTraktUser.png"; shoutItem.IconImageBig = "defaultTraktUserBig.png"; shoutItem.ThumbnailImage = "defaultTraktUserBig.png"; shoutItem.OnItemSelected += OnShoutSelected; Utils.SetDefaultIcons(shoutItem); Facade.Add(shoutItem); users.Add(shout.User); } // Set Facade Layout Facade.SetCurrentLayout("List"); GUIControl.FocusControl(GetID, Facade.GetID); Facade.SelectedListItemIndex = 0; // Download avatars Async and set to facade GetImages(users); }