DepartmentPage.xaml.cs CampusAppWP8::Pages::Departments::DepartmentPage CampusAppWP8::Pages::Departments Microsoft::Phone::Tasks usingCampusAppWP8.Feed.Departments; usingCampusAppWP8.Utility; usingMicrosoft.Phone.Controls; usingMicrosoft.Phone.Tasks; usingSystem; usingSystem.Linq; usingSystem.Windows; usingSystem.Windows.Controls; usingSystem.Windows.Navigation; namespaceCampusAppWP8.Pages.Departments { publicpartialclassDepartmentPage:PhoneApplicationPage { privateUIElementlastVisibleUIElem=null; privateDepartmentFeedfeed{get;set;} publicDepartmentPage() { InitializeComponent(); //initfeedobject this.feed=newDepartmentFeed(); } protectedoverridevoidOnNavigatedTo(NavigationEventArgse) { base.OnNavigatedTo(e); this.feed.EventHandler.FeedIsReadyEvent+=newFeedEventHandler.FeedReadyHandler(SetupDepartmentPivot); this.feed.LoadFeed(); } privatevoidSetupDepartmentPivot() { DepartmentPivot.ItemsSource=feed.Model._faculties; } privatevoidPhoneApplicationPage_OrientationChanged(objectsender,OrientationChangedEventArgse) { } privatevoidDepartmentBtn_Click(objectsender,RoutedEventArgse) { //ifthesenderwasabutton if(senderisButton) { Buttonbtn=senderasButton; //iftheparentisastackpanel if(btn.ParentisStackPanel) { StackPanelpan=(StackPanel)btn.Parent; //ifthereisachildaftertheclickedbuttonintheparentpanel if((pan.Children.Count()>1)&&(pan.Children[1]!=null)) { //iftheclickeddepartmentwasn'ttheoneclickedbefore if(pan.Children[1]!=this.lastVisibleUIElem) { //collapsethelastvisiblechairlist if(this.lastVisibleUIElem!=null) this.lastVisibleUIElem.Visibility=Visibility.Collapsed; //openthechoosenchairlist pan.Children[1].Visibility=Visibility.Visible; this.lastVisibleUIElem=pan.Children[1]; } } } } } privatevoidChairTB_Click(objectsender,RoutedEventArgse) { if(senderisFrameworkElement) { FrameworkElementbtn=senderasFrameworkElement; //ifthechairhasaurlinthetagelement if((btn.Tag!=null)&&((btn.Tagasstring).Length>0)) { //openbrowserwiththeurl WebBrowserTasktask=newWebBrowserTask(); task.Uri=newUri(btn.Tag.ToString(),UriKind.Absolute); task.Show(); } } } } }