Example #1
0
        void btnSwitchTraktSeason_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                AniDB_AnimeVM anime = this.DataContext as AniDB_AnimeVM;
                if (anime == null)
                {
                    return;
                }

                Window wdw = Window.GetWindow(this);

                this.Cursor = Cursors.Wait;
                SelectTraktSeasonForm frm = new SelectTraktSeasonForm();
                frm.Owner = wdw;
                frm.Init(anime.AnimeID, anime.FormattedTitle, AniDB_AnimeCrossRefs.CrossRef_AniDB_Trakt.TraktID,
                         AniDB_AnimeCrossRefs.CrossRef_AniDB_Trakt.TraktSeasonNumber, AniDB_AnimeCrossRefs.TraktShow.Title);
                bool?result = frm.ShowDialog();
                if (result.Value)
                {
                    // update info
                    RefreshData();
                }

                this.Cursor = Cursors.Arrow;
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
Example #2
0
        private void CommandBinding_EditTraktLink(object sender, ExecutedRoutedEventArgs e)
        {
            object obj = e.Parameter;

            if (obj == null)
            {
                return;
            }

            try
            {
                if (obj.GetType() == typeof(CrossRef_AniDB_TraktVMV2))
                {
                    CrossRef_AniDB_TraktVMV2 link = obj as CrossRef_AniDB_TraktVMV2;

                    AniDB_AnimeVM anime = this.DataContext as AniDB_AnimeVM;
                    if (anime == null)
                    {
                        return;
                    }

                    Window wdw = Window.GetWindow(this);

                    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
            {
                this.Cursor = Cursors.Arrow;
            }
        }