WpDetailPage.xaml.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Runtime.InteropServices.WindowsRuntime;
  6. using Windows.Foundation;
  7. using Windows.Foundation.Collections;
  8. using Windows.UI.Core;
  9. using Windows.UI.ViewManagement;
  10. using Windows.UI.Xaml;
  11. using Windows.UI.Xaml.Controls;
  12. using Windows.UI.Xaml.Controls.Primitives;
  13. using Windows.UI.Xaml.Data;
  14. using Windows.UI.Xaml.Input;
  15. using Windows.UI.Xaml.Media;
  16. using Windows.UI.Xaml.Navigation;
  17. using Breda_Tour.Data;
  18. using Breda_Tour.RouteSelectScreen;
  19. // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
  20. namespace Breda_Tour.MapScreen
  21. {
  22. /// <summary>
  23. /// An empty page that can be used on its own or navigated to within a Frame.
  24. /// </summary>
  25. public sealed partial class WpDetailPage : Page
  26. {
  27. private Waypoint wp;
  28. public double Width { get; }
  29. public WpDetailPage()
  30. {
  31. this.InitializeComponent();
  32. Width = ApplicationView.GetForCurrentView().VisibleBounds.Width;
  33. }
  34. protected override void OnNavigatedTo(NavigationEventArgs e)
  35. {
  36. wp = e.Parameter as Waypoint;
  37. this.DataContext = wp;
  38. if (wp.FromPreview)
  39. {
  40. SystemNavigationManager.GetForCurrentView().BackRequested += RouteExample_BackRequested;
  41. }
  42. else
  43. {
  44. SystemNavigationManager.GetForCurrentView().BackRequested += MainPage_BackRequested;
  45. }
  46. SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
  47. wp.FromPreview = false;
  48. }
  49. private void RouteExample_BackRequested(object sender, BackRequestedEventArgs e)
  50. {
  51. e.Handled = true;
  52. SystemNavigationManager.GetForCurrentView().BackRequested -= RouteExample_BackRequested;
  53. MainPage.RootFrame.Navigate(typeof(RouteExample));
  54. }
  55. private void MainPage_BackRequested(object sender, BackRequestedEventArgs e)
  56. {
  57. e.Handled = true;
  58. SystemNavigationManager.GetForCurrentView().BackRequested -= MainPage_BackRequested;
  59. MainPage.RootFrame.Navigate(typeof(MapPage));
  60. }
  61. private void Image_PointerPressed(object sender, TappedRoutedEventArgs e)
  62. {
  63. Image i = (Image)sender;
  64. MainPage.RootFrame.Navigate(typeof(ImageViewPage), new Tuple<ImageSource, Waypoint>(i.Source, wp));
  65. }
  66. private void Image_Tapped(object sender, TappedRoutedEventArgs e)
  67. {
  68. }
  69. }
  70. }