public MainPage() { InitializeComponent(); // Set the data context of the listbox control to the sample data DataContext = App.ViewModel; this.Loaded += new RoutedEventHandler(MainPage_Loaded); } // Load data for the ViewModel Items private void MainPage_Loaded(object sender, RoutedEventArgs e) { if (!App.ViewModel.IsDataLoaded) { App.ViewModel.LoadData(); } } private void ListBox_Loaded(object sender, RoutedEventArgs e) { WebClient Andbeyon = new WebClient(); Andbeyon.DownloadStringCompleted += new DownloadStringCompletedEventHandler(Andbeyon_DownloadStringCompleted); Andbeyon.DownloadStringAsync(new System.Uri("http://gdata.youtube.com/feeds/api/videos?author=gyanandbeyond&v=2&alt=json", UriKind.Absolute)); } void Andbeyon_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { var response = e.Result.Replace("$", "dlr"); var jsonData = JsonConvert.DeserializeObject<rootobject>(response); var src = jsonData.feed.entry.ElementAt(1).mediadlrgroup.mediadlrplayer.url; MediaPlayerLauncher player = new MediaPlayerLauncher(); player.Media = new System.Uri(src, UriKind.Absolute); player.Controls = MediaPlaybackControls.All; player.Orientation = MediaPlayerOrientation.Landscape; player.Show(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)