Esempio n. 1
0
        private void CommandBinding_EditTvDBLink(object sender, ExecutedRoutedEventArgs e)
        {
            object obj = e.Parameter;

            if (obj == null)
            {
                return;
            }

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

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

                    Window wdw = Window.GetWindow(this);

                    this.Cursor = Cursors.Wait;
                    SelectTvDBSeasonForm frm = new SelectTvDBSeasonForm();
                    frm.Owner = wdw;
                    //TODO
                    frm.Init(anime.AnimeID, anime.FormattedTitle, (EpisodeType)link.AniDBStartEpisodeType, link.AniDBStartEpisodeNumber, link.TvDBID,
                             link.TvDBSeasonNumber, link.TvDBStartEpisodeNumber, link.TvDBTitle, anime, link.CrossRef_AniDB_TvDBV2ID);
                    bool?result = frm.ShowDialog();
                    if (result.Value)
                    {
                        // update info
                        RefreshData();
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
            }
        }
Esempio n. 2
0
        private void CommandBinding_EditTvDBLink(object sender, ExecutedRoutedEventArgs e)
        {
            object obj = e.Parameter;

            if (obj == null)
            {
                return;
            }

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

                    if (!(DataContext is VM_AniDB_Anime anime))
                    {
                        return;
                    }

                    Window wdw = Window.GetWindow(this);

                    Cursor = Cursors.Wait;
                    SelectTvDBSeasonForm frm = new SelectTvDBSeasonForm {
                        Owner = wdw
                    };
                    //TODO
                    frm.Init(anime.AnimeID, anime.FormattedTitle, (EpisodeType)link.AniDBStartEpisodeType, link.AniDBStartEpisodeNumber, link.TvDBID,
                             link.TvDBSeasonNumber, link.TvDBStartEpisodeNumber, link.TvDBTitle, anime, true);
                    bool?result = frm.ShowDialog();
                    if (result != null && result.Value)
                    {
                        RefreshData();
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
                Cursor = Cursors.Arrow;
            }
        }