private async void ItemClick_Click(object sender, RoutedEventArgs e) { try { JExercise Exercise = new JExercise(); HyperlinkButton btn = (HyperlinkButton)sender; Exercise = Exercises.Where(x => x.ID == (int)btn.CommandParameter).FirstOrDefault(); this.Frame.Navigate(typeof(ExerciseDetails), Exercise); } catch (Exception) { var dialog = new MessageDialog("Something went wrong with our services. Please try again."); dialog.Commands.Add(new UICommand("OK")); await dialog.ShowAsync(); } }
protected async override void OnNavigatedTo(NavigationEventArgs e) { try { if (e.Parameter is JExercise) { Exercise = e.Parameter as JExercise; } Title.Text = Exercise.ExerciseName; ImageGuide.Source = new BitmapImage(new Uri("ms-appx:/Assets/Exercises/" + Exercise.ExerciseImage)); Description.Text = Exercise.ExerciseDescription; } catch (Exception) { var dialog = new MessageDialog("Something went wrong with our services. Please try again."); dialog.Commands.Add(new UICommand("OK")); await dialog.ShowAsync(); } base.OnNavigatedTo(e); }