public void Init(object comment) { try { if (comment.GetType() == typeof(VM_Trakt_CommentUser)) { VM_Trakt_CommentUser trakt = comment as VM_Trakt_CommentUser; txtFrom.Text = Shoko.Commons.Properties.Resources.ViewComment_FromTrakt; txtUsername.Text = trakt.User.Username; txtDate.Text = ((VM_Trakt_Comment)trakt.Comment).CommentDateString; txtComment.Text = trakt.CommentText; urlWebsite.URL = trakt.Comment.Comment_Url; } else if (comment.GetType() == typeof(VM_AniDB_Recommendation)) { VM_AniDB_Recommendation anidb = comment as VM_AniDB_Recommendation; txtFrom.Text = Shoko.Commons.Properties.Resources.ViewComment_FromAniDB; txtUsername.Text = anidb.UserID.ToString(); txtDate.Text = anidb.GetRecommendationTypeText(); txtComment.Text = anidb.GetComment(); urlWebsite.URL = $"https://anidb.net/perl-bin/animedb.pl?show=threads&do=anime&id={anidb.AnimeID}"; } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private string GetEntityID(ImageDownloadRequest req) { switch (req.ImageType) { case ImageEntityType.AniDB_Cover: VM_AniDB_Anime anime = req.ImageData as VM_AniDB_Anime; return(anime.AnimeID.ToString()); case ImageEntityType.TvDB_Cover: VM_TvDB_ImagePoster poster = req.ImageData as VM_TvDB_ImagePoster; return(poster.TvDB_ImagePosterID.ToString()); case ImageEntityType.TvDB_Banner: VM_TvDB_ImageWideBanner banner = req.ImageData as VM_TvDB_ImageWideBanner; return(banner.TvDB_ImageWideBannerID.ToString()); case ImageEntityType.TvDB_Episode: VM_TvDB_Episode episode = req.ImageData as VM_TvDB_Episode; return(episode.TvDB_EpisodeID.ToString()); case ImageEntityType.TvDB_FanArt: VM_TvDB_ImageFanart fanart = req.ImageData as VM_TvDB_ImageFanart; return(fanart.TvDB_ImageFanartID.ToString()); case ImageEntityType.MovieDB_Poster: VM_MovieDB_Poster moviePoster = req.ImageData as VM_MovieDB_Poster; return(moviePoster.MovieDB_PosterID.ToString()); case ImageEntityType.MovieDB_FanArt: VM_MovieDB_Fanart movieFanart = req.ImageData as VM_MovieDB_Fanart; return(movieFanart.MovieDB_FanartID.ToString()); case ImageEntityType.Trakt_Poster: VM_Trakt_ImagePoster traktPoster = req.ImageData as VM_Trakt_ImagePoster; return(traktPoster.Trakt_ImagePosterID.ToString()); case ImageEntityType.Trakt_Fanart: VM_Trakt_ImageFanart trakFanart = req.ImageData as VM_Trakt_ImageFanart; return(trakFanart.Trakt_ImageFanartID.ToString()); case ImageEntityType.Trakt_CommentUser: VM_Trakt_CommentUser traktShoutUser = req.ImageData as VM_Trakt_CommentUser; return(traktShoutUser.User.Trakt_FriendID.ToString()); case ImageEntityType.Trakt_Episode: VM_Trakt_Episode trakEp = req.ImageData as VM_Trakt_Episode; return(trakEp.Trakt_EpisodeID.ToString()); case ImageEntityType.AniDB_Character: VM_AniDB_Character chr = req.ImageData as VM_AniDB_Character; return(chr.AniDB_CharacterID.ToString()); case ImageEntityType.AniDB_Creator: VM_AniDB_Seiyuu cre = req.ImageData as VM_AniDB_Seiyuu; return(cre.AniDB_SeiyuuID.ToString()); default: return(""); } }