RouteSelectPage.xaml.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using Breda_Tour.Data;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Collections.ObjectModel;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Runtime.InteropServices.WindowsRuntime;
  8. using Windows.Foundation;
  9. using Windows.Foundation.Collections;
  10. using Windows.UI.Core;
  11. using Windows.UI.Xaml;
  12. using Windows.UI.Xaml.Controls;
  13. using Windows.UI.Xaml.Controls.Primitives;
  14. using Windows.UI.Xaml.Data;
  15. using Windows.UI.Xaml.Input;
  16. using Windows.UI.Xaml.Media;
  17. using Windows.UI.Xaml.Navigation;
  18. // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
  19. namespace Breda_Tour.RouteSelectScreen
  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 RouteSelectPage : Page
  25. {
  26. RouteDatabase AllRoutes;
  27. public ObservableCollection<Route> CurrentRoutes
  28. {
  29. get { return (ObservableCollection<Route>)GetValue(HelpItemProperty); }
  30. set { SetValue(HelpItemProperty, value); }
  31. }
  32. public static readonly DependencyProperty HelpItemProperty =
  33. DependencyProperty.Register("CurrentRoutes", typeof(ObservableCollection<Route>), typeof(RouteSelectPage), null);
  34. public RouteSelectPage()
  35. {
  36. AllRoutes = new RouteDatabase();
  37. CurrentRoutes = AllRoutes.GetCurrentRoutes();
  38. this.InitializeComponent();
  39. DefaultPivot.SetCheckedButton(CustomControls.DefaultPivotControl.Tab.RouteSelected);
  40. }
  41. protected override void OnNavigatedTo(NavigationEventArgs e)
  42. {
  43. SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
  44. CurrentRoutes = AllRoutes.GetCurrentRoutes();
  45. }
  46. private void Routes_ItemClick(object sender, ItemClickEventArgs e)
  47. {
  48. Route route = e.ClickedItem as Route;
  49. MainPage.RootFrame.Navigate(typeof(RouteExample), route);
  50. }
  51. private void Page_GotFocus(object sender, RoutedEventArgs e)
  52. {
  53. CurrentRoutes = AllRoutes.GetCurrentRoutes();
  54. }
  55. }
  56. }