Пример #1
0
        private TvdbSearchResult SearchSeries(string idOrName, bool stringIsIMDB = false)
        {
            TvdbSearchResult result;
              if (stringIsIMDB)
              {
            try
            {
              result = TVDB.GetSeriesByRemoteId(ExternalId.ImdbId, idOrName);
              if (result == null)
            return null;
            }
            catch (Exception ex)
            {
              MessageBox.Show("An error occured: " + ex.Message);
              return null;
            }
              }
              else
              {
            try
            {
              var list = TVDB.SearchSeries(idOrName);
              if (list.Count == 0)
              {
            MessageBox.Show("nothing found");
            return null;
              }

              int iResult;
              if (list.Count > 1)
              {
            SearchResult w = new SearchResult();
            w.SetItemSource(list);
            w.ShowDialog();
            iResult = w.SelectedIndex;
              }
              else
            iResult = 0;

              if (iResult < 0)
            return null;

              result = list[iResult];
            }
            catch (Exception ex)
            {
              MessageBox.Show("An error occured: " + ex.Message);
              return null;
            }
              }

              return result;
        }
Пример #2
0
        private MovieSearchResult SearchMovie(string title)
        {
            MovieSearchResult result;
              try
              {
            var list = movieDbApi.SearchMovie(title, App.Config.SelectedTMDBLanguageValue);
            if (list.Count == 0)
            {
              MessageBox.Show("nothing found");
              return null;
            }

            int iResult;
            if (list.Count > 1)
            {
              SearchResult w = new SearchResult();
              w.SetItemSource(list);
              w.ShowDialog();
              iResult = w.SelectedIndex;
            }
            else
              iResult = 0;

            if (iResult < 0)
              return null;

            result = list[iResult];
              }
              catch (Exception ex)
              {
            MessageBox.Show("An error occured: " + ex.Message);
            return null;
              }

              return result;
        }