OpeninghoursPage.xaml.cs CampusAppWP8::Pages::Openinghours::OpeninghoursPage CampusAppWP8::Pages::Openinghours //----------------------------------------------------------------------- //<copyrightfile="OpeninghoursPage.xaml.cs"company="BTU/IIT"> //Companycopyrighttag. //</copyright> //<author>fiedlchr</author> //<sience>24.06.2013</sience> //---------------------------------------------------------------------- namespaceCampusAppWP8.Pages.Openinghours { usingSystem; usingSystem.Windows; usingSystem.Windows.Navigation; usingCampusAppWP8.Feed.Openinghours; usingCampusAppWP8.Model.Openinghours; usingCampusAppWP8.Resources; usingCampusAppWP8.Utility; usingCampusAppWP8.Utility.Lui.MessageBoxes; usingMicrosoft.Phone.Controls; publicpartialclassOpeninghoursPage:PhoneApplicationPage { #regionMembers privateOpeninghoursFeedfeed=null; privateboolisNewInstance=false; #endregion #regionConstructor publicOpeninghoursPage() { this.InitializeComponent(); this.DefHeader.ProgressVisibility=Visibility.Visible; if(this.feed==null) { this.feed=newOpeninghoursFeed(); this.feed.OnLoaded+=newOpeninghoursFeed.OnIO(this.FeedIsReady); this.feed.OnFailedWeb+=newOpeninghoursFeed.OnFailed(this.FeedIsFailedWeb); this.feed.OnFailedFile+=newOpeninghoursFeed.OnFailed(this.FeedIsFailedFile); this.feed.LoadData(Utilities.GetLoadModus<Model.Openinghours.OpeninghoursWp8Model>()); } this.isNewInstance=true; } #endregion #regionMethod #regionprotected protectedoverridevoidOnNavigatedTo(NavigationEventArgse) { base.OnNavigatedTo(e); if(this.Orientation.Equals(PageOrientation.Landscape)||this.Orientation.Equals(PageOrientation.LandscapeLeft)||this.Orientation.Equals(PageOrientation.LandscapeRight)) { ApplicationBar.Mode=Microsoft.Phone.Shell.ApplicationBarMode.Default; } if(this.isNewInstance) { if((this.feed==null)||(this.feed.Model==null)) { OpeninghoursWp8ModeltempModel=null; if((tempModel=App.LoadFromIsolatedStorage<OpeninghoursWp8Model>(Constants.IsolatedStorage_OpeninghoursModel))!=null) { this.feed.Model=tempModel; this.FeedIsReady(); } } this.isNewInstance=false; } } protectedoverridevoidOnNavigatedFrom(NavigationEventArgse) { this.feed.SaveData(); if(e.NavigationMode!=System.Windows.Navigation.NavigationMode.Back) { App.SaveToIsolatedStorage<OpeninghoursWp8Model>(Constants.IsolatedStorage_OpeninghoursModel,this.feed.Model); } } privatevoidOnTapGrid(objectsender,EventArgse) { } protectedoverridevoidOnOrientationChanged(OrientationChangedEventArgse) { if(e.Orientation==PageOrientation.Landscape ||e.Orientation==PageOrientation.LandscapeLeft ||e.Orientation==PageOrientation.LandscapeRight) { ApplicationBar.Mode=Microsoft.Phone.Shell.ApplicationBarMode.Default; } else { ApplicationBar.Mode=Microsoft.Phone.Shell.ApplicationBarMode.Minimized; } base.OnOrientationChanged(e); } //protected #endregion #regionprivate privatevoidFeedIsReady() { this.InstitutionPanel.ItemsSource=this.feed.Model.Institutions; this.DefHeader.ProgressVisibility=Visibility.Collapsed; this.feed.SaveData(); } privatevoidOpenHoursForceUpdate_Click(objectsender,EventArgse) { this.DefHeader.ProgressVisibility=Visibility.Visible; this.feed.ForceWebUpdate(); } privatevoidFeedIsFailedWeb() { MessageBoxResultresult=MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadWeb); this.feed.ForceReadFile(); } privatevoidFeedIsFailedFile() { this.DefHeader.ProgressVisibility=Visibility.Collapsed; MessageBoxResultresult=MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoadFile); } privatevoidInstitutionPanel_SelectionChanged(objectsender,System.Windows.Controls.SelectionChangedEventArgse) { this.InstitutionPanel.SelectedIndex=-1; } //private #endregion //Method #endregion } }