StartPage.xaml.cs CampusAppWP8::Pages::StartPage CampusAppWP8::Pages //----------------------------------------------------------------------- //<copyrightfile="StartPage.xaml.cs"company="BTU/IIT"> //Companycopyrighttag. //</copyright> //<author>stubbfel</author> //<sience>21.05.2013</sience> //---------------------------------------------------------------------- namespaceCampusAppWP8.Pages { usingSystem; usingSystem.Threading; usingSystem.Windows; usingSystem.Windows.Controls; usingSystem.Windows.Navigation; usingCampusAppWP8.Resources; usingCampusAppWP8.Utility; usingCampusAppWP8.Utility.Lui.MessageBoxes; usingMicrosoft.Phone.Controls; usingMicrosoft.Phone.Shell; publicpartialclassStartPage:PhoneApplicationPage { publicStartPage() { this.InitializeComponent(); ApplicationBarMenuItemmenuItem1=ApplicationBar.MenuItems[0]asApplicationBarMenuItem; ApplicationBarMenuItemmenuItem2=ApplicationBar.MenuItems[1]asApplicationBarMenuItem; if(menuItem1!=null) { menuItem1.Text=AppResources.Setting_UserProfilAppBarTitle; } if(menuItem2!=null) { menuItem2.Text=AppResources.Setting_ApplAppBarTitle; } if(!Settings.AppSetting.InitApp) { this.ShowOptIns(); Settings.AppSetting.InitApp=true; } } protectedoverridevoidOnNavigatedTo(NavigationEventArgse) { base.OnNavigatedTo(e); } privatevoidPhoneApplicationPage_OrientationChanged(objectsender,OrientationChangedEventArgse) { //Switchtheplacementofthebuttonsbasedonanorientationchange. if(this.Orientation==PageOrientation.LandscapeLeft||this.Orientation==PageOrientation.LandscapeRight) { OpenHoursAppButton.SetValue(Grid.RowProperty,0); OpenHoursAppButton.SetValue(Grid.ColumnProperty,3); OpenHoursAppButtonText.Text=AppResources.OpenHoursApp_Title; OSAAppButton.SetValue(Grid.RowProperty,1); OSAAppButton.SetValue(Grid.ColumnProperty,3); LinkAppButton.SetValue(Grid.RowProperty,2); LinkAppButton.SetValue(Grid.ColumnProperty,3); ContentPanel.Margin=newThickness(12,-24,0,0); HomeworkAppButtonText.Text=AppResources.HomeworkApp_Title; ContentPanel.RowDefinitions[3].Height=GridLength.Auto; ContentPanel.ColumnDefinitions[3].Width=newGridLength(1,GridUnitType.Star); } else { //Ifnotinportrait,movebuttonListcontenttovisiblerowandcolumn. ContentPanel.Margin=newThickness(12,0,12,12); OpenHoursAppButton.SetValue(Grid.RowProperty,3); OpenHoursAppButton.SetValue(Grid.ColumnProperty,0); OpenHoursAppButtonText.Text=AppResources.OpenHoursApp_Title2; OSAAppButton.SetValue(Grid.RowProperty,3); OSAAppButton.SetValue(Grid.ColumnProperty,1); LinkAppButton.SetValue(Grid.RowProperty,3); LinkAppButton.SetValue(Grid.ColumnProperty,2); HomeworkAppButtonText.Text=AppResources.HomeworkApp_Title2; ContentPanel.RowDefinitions[3].Height=newGridLength(1,GridUnitType.Star); ContentPanel.ColumnDefinitions[3].Width=GridLength.Auto; } } privatevoidApplicationBarMenuItem_Click(objectsender,EventArgse) { Uriurl=newUri(Constants.PathSetting_User,UriKind.Relative); NavigationService.Navigate(url); } privatevoidApplicationBarMenuItem2_Click(objectsender,EventArgse) { Uriurl=newUri(Constants.PathSetting_App,UriKind.Relative); NavigationService.Navigate(url); } privatevoidApplicationBar_StateChanged(objectsender,ApplicationBarStateChangedEventArgse) { if(e.IsMenuVisible) { ApplicationBar.Opacity=0.99; } else { ApplicationBar.Opacity=0.5; } } privatevoidShowOptIns() { this.GeoWatchOptIN(); } privatevoidGeoWatchOptIN() { MessageBoxResultresult=MessageBoxes.ShowGoeWatchOptInBox(); if(result==MessageBoxResult.OK) { Settings.AppSetting.GeoWatchEnable=true; Threadthread=newThread(newThreadStart(Utilities.DetermineAndStoreCurrentPosition)); thread.Start(); } else { Settings.AppSetting.GeoWatchEnable=false; } } } }