Esempio n. 1
0
 public void LoadDvdReviewsAsync()
 {
     if (HasMoreDvdReviews)
     {
         WebClient wc = new WebClient();
         DownloadStringCompletedEventHandler f = null;
         f = (s, ea) => {
             wc.DownloadStringCompleted -= f;
             dynamic json = DynamicJsonObject.Parse(ea.Result);
             dvdReviewTotal = DynamicJsonObject.ParseIntFromDyn(json.total);
             if (DvdReviews == null)
             {
                 DvdReviews = new List <Review>();
             }
             foreach (var rev in json.reviews)
             {
                 DvdReviews.Add(new Review(rev));
             }
             OnLoadReviewsCompleted();
         };
         wc.DownloadStringCompleted += f;
         wc.DownloadStringAsync(new Uri(nextDvdReviewLink));
     }
     else
     {
         OnLoadReviewsCompleted();
     }
 }
        private void Parse(string jsonString, int pageSize)
        {
            PageSize    = pageSize;
            currentPage = 1;
            dynamic json = DynamicJsonObject.Parse(jsonString);

            Total  = DynamicJsonObject.ParseIntFromDyn(json.total);
            Movies = new List <Movie>();
            foreach (var m in json.movies)
            {
                Movies.Add(new Movie(m, true));
            }
            SearchLinks = new SearchLinks(json.links, json.link_template);
        }
Esempio n. 3
0
 internal void Parse(dynamic json, bool isAbbrev = false)
 {
     Id    = DynamicJsonObject.ParseIntFromDyn(json.id);
     Title = json.title;
     Year  = DynamicJsonObject.ParseIntFromDyn(json.year);
     if (isAbbrev)
     {
         Genres            = null;
         AbridgedDirectors = null;
     }
     else
     {
         Genres = new List <string>();
         foreach (var g in json.genres)
         {
             Genres.Add(g);
         }
         if (json.abridged_directors == null)
         {
             AbridgedDirectors = null;
         }
         else
         {
             AbridgedDirectors = new List <string>();
             foreach (var ad in json.abridged_directors)
             {
                 AbridgedDirectors.Add(ad.name);
             }
         }
     }
     MPAARating   = json.mpaa_rating;
     Runtime      = DynamicJsonObject.ParseIntFromDyn(json.runtime);
     ReleaseDates = new ReleaseDates(json.release_dates);
     Ratings      = new Ratings(json.ratings);
     Synopsis     = json.synopsis;
     Posters      = new Posters(json.posters);
     AbridgedCast = new List <CastMember>();
     foreach (var ac in json.abridged_cast)
     {
         AbridgedCast.Add(new CastMember(ac));
     }
     Links      = new MovieLinks(json.links);
     IsAbridged = isAbbrev;
 }