/// <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 Tvdb(_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) { cbUserFavourites.Items.Add(s); } } } else { cbUserFavourites.Text = "No userinfo set"; cbUserFavourites.Enabled = false; } cmdAddRemoveFavorites.Enabled = false; cmdSendSeriesRating.Enabled = false; raterSeriesYourRating.Enabled = false; }
private void cmdInit_Click(object sender, EventArgs e) { m_tvdbHandler = new Tvdb(new XmlCacheProvider("C:\\test"), Resources.API_KEY); List<TvdbLanguage> lang = m_tvdbHandler.Languages; cmdTest1.Enabled = true; cmdTestZip.Enabled = true; cmdGetEpisodes.Enabled = true; cmdEnd.Enabled = true; cmdSetUser.Enabled = true; cmdGetEpisodeAired.Enabled = true; }