private void CommandBinding_ReportTraktLink(object sender, ExecutedRoutedEventArgs e) { object obj = e.Parameter; if (obj == null) { return; } try { if (obj.GetType() == typeof(VM_CrossRef_AniDB_TvDBV2)) { VM_CrossRef_AniDB_TraktV2 link = obj as VM_CrossRef_AniDB_TraktV2; VM_AniDB_Anime anime = DataContext as VM_AniDB_Anime; if (anime == null) { return; } Cursor = Cursors.Wait; } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { Cursor = Cursors.Arrow; } }
private void CommandBinding_DeleteTraktLink(object sender, ExecutedRoutedEventArgs e) { object obj = e.Parameter; if (obj == null) { return; } try { if (obj.GetType() == typeof(VM_CrossRef_AniDB_TraktV2)) { VM_CrossRef_AniDB_TraktV2 link = obj as VM_CrossRef_AniDB_TraktV2; VM_AniDB_Anime anime = DataContext as VM_AniDB_Anime; if (anime == null) { return; } Cursor = Cursors.Wait; Window wdw = Window.GetWindow(this); string msg = string.Format(Shoko.Commons.Properties.Resources.CommunityLinks_DeleteLink); MessageBoxResult result = MessageBox.Show(msg, Shoko.Commons.Properties.Resources.Confirm, MessageBoxButton.YesNo, MessageBoxImage.Warning); if (result == MessageBoxResult.Yes) { Cursor = Cursors.Wait; string res = VM_ShokoServer.Instance.ShokoServices.RemoveLinkAniDBTrakt(link.AnimeID, link.AniDBStartEpisodeType, link.AniDBStartEpisodeNumber, link.TraktID, link.TraktSeasonNumber, link.TraktStartEpisodeNumber); if (res.Length > 0) { MessageBox.Show(res, Shoko.Commons.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); } else { // update info RefreshData(); } Cursor = Cursors.Arrow; } } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { Cursor = Cursors.Arrow; } }
void dgTraktResults_SelectionChanged(object sender, SelectionChangedEventArgs e) { e.Handled = true; VM_CrossRef_AniDB_TraktV2 xref = ((DataGrid)sender).SelectedItem as VM_CrossRef_AniDB_TraktV2; if (xref == null) { return; } ShowAniDBWebPage(xref.GetAniDBURL()); ShowOtherWebPage(xref.GetShowURL()); }
private void CommandBinding_Revoke(object sender, ExecutedRoutedEventArgs e) { Window parentWindow = Window.GetWindow(this); object obj = e.Parameter; if (obj == null) { return; } try { if (obj.GetType() == typeof(VM_CrossRef_AniDB_TvDBV2)) { VM_CrossRef_AniDB_TvDBV2 xref = obj as VM_CrossRef_AniDB_TvDBV2; string res = VM_ShokoServer.Instance.ShokoServices.RevokeTVDBCrossRefWebCache(xref.CrossRef_AniDB_TvDBV2ID); if (string.IsNullOrEmpty(res)) { xref.IsAdminApproved = 0; } else { MessageBox.Show(res, Shoko.Commons.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); } } if (obj.GetType() == typeof(VM_CrossRef_AniDB_TraktV2)) { VM_CrossRef_AniDB_TraktV2 xref = obj as VM_CrossRef_AniDB_TraktV2; string res = VM_ShokoServer.Instance.ShokoServices.RevokeTraktCrossRefWebCache(xref.CrossRef_AniDB_TraktV2ID); if (string.IsNullOrEmpty(res)) { xref.IsAdminApproved = 0; } else { MessageBox.Show(res, Shoko.Commons.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); } } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private void CommandBinding_EditTraktLink(object sender, ExecutedRoutedEventArgs e) { object obj = e.Parameter; if (obj == null) { return; } try { if (obj.GetType() == typeof(VM_CrossRef_AniDB_TraktV2)) { VM_CrossRef_AniDB_TraktV2 link = obj as VM_CrossRef_AniDB_TraktV2; VM_AniDB_Anime anime = DataContext as VM_AniDB_Anime; if (anime == null) { return; } Window wdw = Window.GetWindow(this); Cursor = Cursors.Wait; SelectTraktSeasonForm frm = new SelectTraktSeasonForm(); frm.Owner = wdw; frm.Init(anime.AnimeID, anime.FormattedTitle, (EpisodeType)link.AniDBStartEpisodeType, link.AniDBStartEpisodeNumber, link.TraktID, link.TraktSeasonNumber, link.TraktStartEpisodeNumber, link.TraktTitle, anime, link.CrossRef_AniDB_TraktV2ID); bool?result = frm.ShowDialog(); if (result.Value) { // update info RefreshData(); } } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { Cursor = Cursors.Arrow; } }