コード例 #1
0
 private void searchbutton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         imdbids.Clear();
         lstmovie.Items.Clear();
         string url = util.getSerarchApi(txtUserEntry.Text);
         WebClient wc = new WebClient();
         String s = wc.DownloadString(url);
         if (s.Length > 75)
         {
             sj = JsonConvert.DeserializeObject<Rootobject>(s);
             if (sj == null)
             {
                 ModernDialog.ShowMessage("no matching movies found", "movies", MessageBoxButton.OK);
             }
             else
             {
                 foreach (Search movie in sj.Search)
                 {
                     lstmovie.Items.Add(movie.Title + " (" + movie.Year + ")");
                     imdbids.Add(movie.imdbID);
                 }
             }
         }
     }
     catch (Exception)
     { }
 }
コード例 #2
0
 public add_search()
 {
     try
     {
         util = new Util();
         DatabaseConnection dbc = new DatabaseConnection();
         c = dbc.getConnection();
         cmd = c.CreateCommand();
         sj = new Rootobject();
         imdbids = new List<string>();
         InitializeComponent();
     }
     catch (Exception)
     { }
 }