protected void SetImageToGui(string imageFilePath)
{
if (string.IsNullOrEmpty(imageFilePath) || Show == null) return;
// determine the overlays to add to poster
var mainOverlay = MainOverlayImage.None;
// don't show watchlist overlay in personal watchlist window
if (WindowID == (int)TraktGUIWindows.WatchedListShows)
{
if ((GUIWatchListShows.CurrentUser != TraktSettings.Username) && Show.IsWatchlisted())
mainOverlay = MainOverlayImage.Watchlist;
else if (Show.IsWatched())
mainOverlay = MainOverlayImage.Seenit;
}
else
{
if (Show.IsWatchlisted())
mainOverlay = MainOverlayImage.Watchlist;
else if (Show.IsWatched())
mainOverlay = MainOverlayImage.Seenit;
}
// add additional overlay if applicable
if (Show.IsCollected())
mainOverlay |= MainOverlayImage.Library;
RatingOverlayImage ratingOverlay = GUIImageHandler.GetRatingOverlay(Show.UserRating());
// get a reference to a MediaPortal Texture Identifier
string suffix = Enum.GetName(typeof(MainOverlayImage), mainOverlay) + Enum.GetName(typeof(RatingOverlayImage), ratingOverlay);
string texture = GUIImageHandler.GetTextureIdentFromFile(imageFilePath, suffix);
// build memory image
Image memoryImage = null;
if (mainOverlay != MainOverlayImage.None || ratingOverlay != RatingOverlayImage.None)
{
memoryImage = GUIImageHandler.DrawOverlayOnPoster(imageFilePath, mainOverlay, ratingOverlay);
if (memoryImage == null) return;
// load texture into facade item
if (GUITextureManager.LoadFromMemory(memoryImage, texture, 0, 0, 0) > 0)
{
ThumbnailImage = texture;
IconImage = texture;
IconImageBig = texture;
}
}
else
{
ThumbnailImage = imageFilePath;
IconImage = imageFilePath;
IconImageBig = imageFilePath;
}
// if selected and is current window force an update of thumbnail
this.UpdateItemIfSelected(WindowID, ItemId);
}