void btnTvDBLinkAdd_Click(object sender, RoutedEventArgs e) { try { // get the current tvdb link VM_AnimeEpisode_User ep = DataContext as VM_AnimeEpisode_User; ep.RefreshAnime(); if (ep.AniDB_Anime == null || ep.AniDB_Anime.TvSummary == null || ep.AniDB_Anime.TvSummary.CrossRefTvDBV2 == null || ep.AniDB_Anime.TvSummary.CrossRefTvDBV2.Count == 0) { Utils.ShowErrorMessage(Shoko.Commons.Properties.Resources.EpisodeDetail_TvDBLink); return; } Window wdw = Window.GetWindow(this); Cursor = Cursors.Wait; SelectTvDBEpisodeForm frm = new SelectTvDBEpisodeForm(); frm.Owner = wdw; frm.Init(ep, ep.AniDB_Anime); bool?result = frm.ShowDialog(); if (result.Value) { // update info CL_AnimeEpisode_User contract = VM_ShokoServer.Instance.ShokoServices.GetEpisode( ep.AnimeEpisodeID, VM_ShokoServer.Instance.CurrentUser.JMMUserID); if (contract != null) { ep.RefreshAnime(true); ep.Populate(contract); ep.SetTvDBInfo(); } } Cursor = Cursors.Arrow; } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
void btnTvDBLinkAdd_Click(object sender, RoutedEventArgs e) { try { // get the current tvdb link AnimeEpisodeVM ep = this.DataContext as AnimeEpisodeVM; ep.RefreshAnime(); if (ep.AniDB_Anime == null || ep.AniDB_Anime.TvSummary == null || ep.AniDB_Anime.TvSummary.CrossRefTvDBV2 == null || ep.AniDB_Anime.TvSummary.CrossRefTvDBV2.Count == 0) { Utils.ShowErrorMessage("The series must be linked to a TvDB series first"); return; } Window wdw = Window.GetWindow(this); this.Cursor = Cursors.Wait; SelectTvDBEpisodeForm frm = new SelectTvDBEpisodeForm(); frm.Owner = wdw; frm.Init(ep, ep.AniDB_Anime); bool?result = frm.ShowDialog(); if (result.Value) { // update info JMMServerBinary.Contract_AnimeEpisode contract = JMMServerVM.Instance.clientBinaryHTTP.GetEpisode( ep.AnimeEpisodeID, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); if (contract != null) { ep.RefreshAnime(true); ep.Populate(contract); ep.SetTvDBInfo(); } } this.Cursor = Cursors.Arrow; } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }