Example #1
0
 private void loadVideoByStandardFeed(StandardFeed feedQuery)
 {
     try
     {
         if (datasource != null) datasource.Clear();
         else datasource = new List<VideoBase>();
         if (this.lbResult == null) this.lbResult = new ListBox();
         if (this.horizontalListBox == null) this.horizontalListBox = new ListBox();
         List<VideoBase> list = new List<VideoBase>();
         list = YoutubeProvider.GetStandardFeed(feedQuery);
         if (list == null || list.Count == 0) return;
         datasource.Clear();
         datasource = list;
         this.lbResult.ItemsSource = datasource;
     }
     catch { }
 }
Example #2
0
 public static List<VideoBase> GetStandardFeed(StandardFeed feed)
 {
     List<VideoBase> list = new List<VideoBase>();
     try
     {
         string feedQuery = "";
         switch (feed)
         {
             case StandardFeed.MOST_DISCUSSED:
                 feedQuery = "most_discussed";
                 break;
             case StandardFeed.MOST_POPULAR:
                 feedQuery = "most_popular";
                 break;
             case StandardFeed.MOST_RECENT:
                 feedQuery = "most_recent";
                 break;
             case StandardFeed.MOST_RESPONDED:
                 feedQuery = "most_responded";
                 break;
             case StandardFeed.MOST_SHARED:
                 feedQuery = "most_shared";
                 break;
             case StandardFeed.ON_THE_WEB:
                 feedQuery = "on_the_web";
                 break;
             case StandardFeed.RECENTLY_FEATURED:
                 feedQuery = "recently_featured";
                 break;
             case StandardFeed.TOP_FAVORITES:
                 feedQuery = "top_favorites";
                 break;
             case StandardFeed.TOP_RATED:
                 feedQuery = "top_rated";
                 break;
         }
         YouTubeRequest ytRequest = new YouTubeRequest(new YouTubeRequestSettings(APP_NAME, DEV_KEY));
         Feed<Video> vid_feed = ytRequest.Get<Video>(new Uri("https://gdata.youtube.com/feeds/api/standardfeeds/" + feedQuery));
         foreach (Video video in vid_feed.Entries)
         {
             VideoBase baseVideo = ConvertToVideoBase(video);
             list.Add(baseVideo);
         }
     }
     catch
     {
     }
     return list;
 }