Exemplo n.º 1
0
        /// <summary>
        /// Initialise the form
        /// </summary>
        /// <param name="_userId"></param>
        public void InitialiseForm(String _userId, ICacheProvider _provider)
        {
            //m_tvdbHandler = new Tvdb(new BinaryCacheProvider(@"cachefile.bin"), Resources.API_KEY);new XmlCacheProvider("XmlCache")

            m_tvdbHandler = new TvdbHandler(_provider, Resources.API_KEY);
            m_tvdbHandler.InitCache();

            List <TvdbLanguage> m_languages = m_tvdbHandler.Languages;

            foreach (TvdbLanguage l in m_languages)
            {
                if (l.Abbriviation.Equals("en"))
                {
                    m_currentLanguage = l;
                }
                cbLanguage.Items.Add(l);
            }
            lblCurrentLanguage.Text = "[" + m_currentLanguage.ToString() + "]";

            //enable/disable community features
            if (_userId != null)
            {
                TvdbUser user = new TvdbUser("user", _userId);
                m_tvdbHandler.UserInfo = user;
                List <TvdbSeries> favList = null;
                try
                {
                    user.UserPreferredLanguage = m_tvdbHandler.GetPreferredLanguage();
                    favList = m_tvdbHandler.GetUserFavorites(user.UserPreferredLanguage);
                }
                catch (TvdbInvalidApiKeyException ex)
                {
                    MessageBox.Show(ex.Message);
                }
                catch (TvdbNotAvailableException ex)
                {
                    MessageBox.Show(ex.Message);
                }

                if (favList != null)
                {
                    foreach (TvdbSeries s in favList)
                    {
                        if (s != null)
                        {
                            cbUserFavourites.Items.Add(s);
                        }
                    }
                }
            }
            else
            {
                cbUserFavourites.Text    = "No userinfo set";
                cbUserFavourites.Enabled = false;
            }

            cmdAddRemoveFavorites.Enabled = false;
            cmdSendSeriesRating.Enabled   = false;
            raterSeriesYourRating.Enabled = false;
        }
Exemplo n.º 2
0
        public ListeSeries()
        {
            TvdbHandler tvdbHandler = new TvdbHandler(new XmlCacheProvider(System.Environment.CurrentDirectory + @"\Cache\Series\"), "69C6FDC7E5F4B985");

            tvdbHandler.InitCache();
            TvdbUser user = new TvdbUser("Danone-KiD", "401D8B31F9832AA3");

            tvdbHandler.UserInfo = user;
            tvdbHandler.UserInfo.UserPreferredLanguage = tvdbHandler.GetPreferredLanguage();
            //get list of all favorites and print them to console
            List <int> favList = tvdbHandler.GetUserFavouritesList();

            foreach (int id in favList)
            {
                //TvdbSeries s = tvdbHandler.GetSeries(id, tvdbHandler.UserInfo.UserPreferredLanguage, true, true, true);
                Add(new Serie(tvdbHandler, id));
            }
            //Thumb t = new Thumb("http://thetvdb.com/banners/" + s.BannerPath);
            //this.DataContext = s;
            //lstSaisons.ItemsSource = seasonList;
            tvdbHandler.CloseCache();
        }