NewsPage.xaml.cs CampusAppWP8::Pages::News::NewsPage CampusAppWP8::Pages::News System::Xml::Linq System::Xml System::IO usingSystem; usingSystem.Collections.Generic; usingSystem.Linq; usingSystem.Net; usingSystem.Windows; usingSystem.Windows.Controls; usingSystem.Windows.Navigation; usingMicrosoft.Phone.Controls; usingMicrosoft.Phone.Shell; usingSystem.Xml.Linq; usingSystem.Xml; usingSystem.IO; usingMicrosoft.Phone.Tasks; usingCampusAppWP8.Model.events_news; usingCampusAppWP8.Utility; usingCampusAppWP8.Resources; namespaceCampusAppWP8.Pages.News { publicpartialclassNewsPage:PhoneApplicationPage { privateboolisSourceSet=false; publicNewsPage() { InitializeComponent(); } protectedoverridevoidOnNavigatedTo(NavigationEventArgse) { base.OnNavigatedTo(e); //SetpivotitemSource if(this.isSourceSet==false) { if((NewsIndexPage.GetNewsFeed.Model!=null) &&(NewsIndexPage.GetNewsFeed.Model.Channel!=null) &&(NewsIndexPage.GetNewsFeed.Model.Channel.Count()>=1)) { this.NewsPivot.ItemsSource=NewsIndexPage.GetNewsFeed.Model.Channel[0].item; this.isSourceSet=true; } } stringpivotIndex=""; //Navigatetotheselectedpivotitem if(NavigationContext.QueryString.TryGetValue("pivotindex",outpivotIndex)) { intpivotIndexInt=int.Parse(pivotIndex); //iftheindexisintherangeofthearray if((pivotIndexInt>=0)&&(pivotIndexInt<NewsIndexPage.GetNewsFeed.Model.Channel[0].item.Count())) NewsPivot.SelectedIndex=pivotIndexInt; else MessageBox.Show("ERROR:pivotIndexoutofrange!!!"); } } privatevoidNewsHome_Click(objectsender,RoutedEventArgse) { //Navigatebacktothenewsindexpage NavigationService.GoBack(); } privatevoidNewsLink_Click(objectsender,RoutedEventArgse) { FrameworkElementfe=senderasFrameworkElement; //Openthewebbrowser WebBrowserTaskwebBrowserTask=newWebBrowserTask(); webBrowserTask.Uri=newUri(fe.Tag.ToString(),UriKind.Absolute); webBrowserTask.Show(); } } }