Example #1
0
 private void btnSearch_Click(object sender, RoutedEventArgs e)
 {
     if (tbSearch.Text != null)
     {
         Tvdb api = new Tvdb(ApiKey);
         api.SearchSeries(tbSearch.Text, null, result =>
         {
             if (result.Data != null)
             {
                 listbox.ItemsSource = (from s in result.Data
                                        select new Series
                 {
                     SeriesId = s.id,
                     Title = s.SeriesName,
                     Overview = s.Overview,
                     Banner = s.banner
                 }).ToList();
             }
             else
             {
                 MessageBox.Show(api.Error, "Error", MessageBoxButton.OK);
             }
         });
     }
 }
Example #2
0
        static void Main(string[] args)
        {
            Tvdb api     = new Tvdb("apikey");
            var  mirrors = api.GetMirrors();

            Console.Write("Enter TV Series: ");
            var search = Console.ReadLine();

            if (string.IsNullOrEmpty(search))
            {
                return;
            }

            Console.WriteLine("Synchronous call...");
            {
                var result = api.SearchSeries(search);
                Console.WriteLine(string.Format("{0} matches found", result.Count));

                foreach (var item in result)
                {
                    Console.WriteLine(string.Format("{0} #{1}", item.SeriesName, item.id));
                }
            }

            Console.WriteLine("Asynchronous call...");
            {
                api.SearchSeries(search, "Sample async call", result =>
                {
                    Console.WriteLine(result.UserState as string);

                    Console.WriteLine(string.Format("{0} matches found", result.Data.Count));

                    foreach (var item in result.Data)
                    {
                        Console.WriteLine(string.Format("{0} #{1}", item.SeriesName, item.id));
                    }
                });
            }


            Console.WriteLine("Press any key...");
            Console.Read();
        }
Example #3
0
 private void cmdFindSeries_Click(object sender, EventArgs e)
 {
     if (!txtSeriesToFind.Text.Equals(""))
     {
         List <TvdbSearchResult> list = m_tvdbHandler.SearchSeries(txtSeriesToFind.Text);
         if (list != null && list.Count > 0)
         {
             SearchResultForm form = new SearchResultForm(list);
             form.StartPosition = FormStartPosition.Manual;
             form.Left          = this.Left + this.Width / 2 - form.Width / 2;
             form.Top           = this.Top + this.Height / 2 - form.Height / 2;
             DialogResult res = form.ShowDialog();
             if (res == DialogResult.OK)
             {
                 LoadSeries(form.Selection.Id);
             }
         }
         else
         {
             MessageBox.Show("No results for this series");
         }
     }
 }