WpDetailPage.xaml.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
  19. namespace Breda_Tour.MapScreen
  20. {
  21. /// <summary>
  22. /// An empty page that can be used on its own or navigated to within a Frame.
  23. /// </summary>
  24. public sealed partial class WpDetailPage : Page
  25. {
  26. private Waypoint wp;
  27. public double Width { get; }
  28. public WpDetailPage()
  29. {
  30. this.InitializeComponent();
  31. Width = ApplicationView.GetForCurrentView().VisibleBounds.Width;
  32. }
  33. protected override void OnNavigatedTo(NavigationEventArgs e)
  34. {
  35. wp = e.Parameter as Waypoint;
  36. this.DataContext = wp;
  37. SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
  38. SystemNavigationManager.GetForCurrentView().BackRequested += MainPage_BackRequested;
  39. }
  40. private void MainPage_BackRequested(object sender, BackRequestedEventArgs e)
  41. {
  42. e.Handled = true;
  43. SystemNavigationManager.GetForCurrentView().BackRequested -= MainPage_BackRequested;
  44. MainPage.RootFrame.Navigate(typeof(MapPage));
  45. }
  46. private void Image_PointerPressed(object sender, TappedRoutedEventArgs e)
  47. {
  48. Image i = (Image)sender;
  49. MainPage.RootFrame.Navigate(typeof(ImageViewPage), new Tuple<ImageSource, Waypoint>(i.Source, wp));
  50. }
  51. private void Image_Tapped(object sender, TappedRoutedEventArgs e)
  52. {
  53. }
  54. }
  55. }