protected override void OnNavigatedTo(NavigationEventArgs e) { try { string user = NavigationContext.QueryString["user"]; // Load the public journal settings for the requested user // if the public journal settings instance is null than that user has not elected // to share thier journal if (!String.IsNullOrEmpty(user)) { Title = String.Format("{0}'s Fitness Journal", user); journalContext.Load <PublicJournalSettings>(journalContext.GetPublicJournalSettingsQuery(user), (JournalLoaded) => { if (!JournalLoaded.HasError) { IEnumerator <PublicJournalSettings> enumerator = JournalLoaded.Entities.GetEnumerator(); enumerator.MoveNext(); if (enumerator.Current != null) { // At this point we have a valid PublicJournal object so the user // is currently sharing journal information now we need to look at // what options have been enabled settings = enumerator.Current; LoadPublicJournal(); } else { NavigationService.Navigate(new Uri("Home", UriKind.Relative)); } } else { NavigationService.Navigate(new Uri("Home", UriKind.Relative)); } }, null); } else { NavigationService.Navigate(new Uri("Home", UriKind.Relative)); } } catch (Exception) { NavigationService.Navigate(new Uri("Home", UriKind.Relative)); } }