DepartmentPage.xaml.cs CampusAppWP8::Pages::Departments::DepartmentPage CampusAppWP8::Pages::Departments <<<<<<< HEAD usingCampusAppWP8.Api.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(); } } } } } ======= //----------------------------------------------------------------------- //<copyrightfile="DepartmentPage.xaml.cs"company="BTU/IIT"> //Companycopyrighttag. //</copyright> //<author>fiedlchr</author> //<sience>24.06.2013</sience> //---------------------------------------------------------------------- namespaceCampusAppWP8.Pages.Departments { usingSystem; usingSystem.Linq; usingSystem.Windows; usingSystem.Windows.Controls; usingSystem.Windows.Navigation; usingCampusAppWP8.Resources; usingMicrosoft.Phone.Controls; publicpartialclassDepartmentPage:PhoneApplicationPage { privateboolisSourceSet=false; privateFrameworkElementlastClickedBtn=null; publicDepartmentPage() { this.InitializeComponent(); } protectedoverridevoidOnNavigatedTo(NavigationEventArgse) { base.OnNavigatedTo(e); if(this.isSourceSet==false) { this.DepartmentPivot.ItemsSource=DepartmentIndexPage.GetFeed().GetModel().Faculties; this.isSourceSet=true; } stringpivotIndex=string.Empty; //Navigatetotheselectedpivotitem if(NavigationContext.QueryString.TryGetValue("pivotindex",outpivotIndex)) { intpivotIndexInt=int.Parse(pivotIndex)-1; //iftheindexisintherangeofthearray if((pivotIndexInt>=0)&&(pivotIndexInt<DepartmentIndexPage.GetFeed().GetModel().Faculties.Count())) { DepartmentPivot.SelectedIndex=pivotIndexInt; } else { MessageBox.Show("ERROR:pivotIndexoutofrange!!!"); } } } privatevoidPhoneApplicationPage_OrientationChanged(objectsender,OrientationChangedEventArgse) { } privatevoidChairTB_Click(objectsender,RoutedEventArgse) { FrameworkElementtempBtn=senderasFrameworkElement; StackPaneltempParent=null; if(this.lastClickedBtn!=tempBtn) { if(this.lastClickedBtn!=null) { tempParent=this.lastClickedBtn.ParentasStackPanel; tempParent.Children[1].Visibility=Visibility.Collapsed; } tempParent=tempBtn.ParentasStackPanel; tempParent.Children[1].Visibility=Visibility.Visible; this.lastClickedBtn=tempBtn; } else { tempParent=this.lastClickedBtn.ParentasStackPanel; tempParent.Children[1].Visibility=Visibility.Collapsed; this.lastClickedBtn=null; } } privatevoidAddBtn_Click(objectsender,RoutedEventArgse) { Buttonbtn=this.lastClickedBtnasButton; TextBlockbtnText=btn.ContentasTextBlock; Model.Departments.ChairModeltempModel=DepartmentIndexPage.GetFeed().GetModel().Faculties[this.DepartmentPivot.SelectedIndex].GetChairModel(btnText.Text); if(tempModel!=null) { DepartmentIndexPage.GetFavoriteFeed().GetModel().Faculties[0].AddChair(tempModel); } } privatevoidInfoBtn_Click(objectsender,RoutedEventArgse) { FrameworkElementinfoBtn=senderasFrameworkElement; stringchairName=((this.lastClickedBtnasButton).ContentasTextBlock).Text.ToString(); NavigationService.Navigate(newUri(Constants.PathDepartment_DepartmentInfoPage+"?url="+infoBtn.Tag.ToString()+"&name="+chairName,UriKind.Relative)); } } } >>>>>>> develmaster