RouteSelectPage.xaml.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using Breda_Tour.Data;
  2. using System.Collections.ObjectModel;
  3. using Windows.UI.Core;
  4. using Windows.UI.Xaml;
  5. using Windows.UI.Xaml.Controls;
  6. using Windows.UI.Xaml.Navigation;
  7. namespace Breda_Tour.RouteSelectScreen
  8. {
  9. public sealed partial class RouteSelectPage : Page
  10. {
  11. RouteDatabase AllRoutes;
  12. public ObservableCollection<Route> CurrentRoutes
  13. {
  14. get { return (ObservableCollection<Route>)GetValue(HelpItemProperty); }
  15. set { SetValue(HelpItemProperty, value); }
  16. }
  17. public static readonly DependencyProperty HelpItemProperty =
  18. DependencyProperty.Register("CurrentRoutes", typeof(ObservableCollection<Route>), typeof(RouteSelectPage), null);
  19. public RouteSelectPage()
  20. {
  21. AllRoutes = new RouteDatabase();
  22. CurrentRoutes = AllRoutes.GetCurrentRoutes();
  23. this.InitializeComponent();
  24. DefaultPivot.SetCheckedButton(CustomControls.DefaultPivotControl.Tab.RouteSelected);
  25. }
  26. protected override void OnNavigatedTo(NavigationEventArgs e)
  27. {
  28. SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
  29. CurrentRoutes = AllRoutes.GetCurrentRoutes();
  30. }
  31. private void Routes_ItemClick(object sender, ItemClickEventArgs e)
  32. {
  33. Route route = e.ClickedItem as Route;
  34. MainPage.RootFrame.Navigate(typeof(RouteExample), route);
  35. }
  36. private void Page_GotFocus(object sender, RoutedEventArgs e)
  37. {
  38. CurrentRoutes = AllRoutes.GetCurrentRoutes();
  39. }
  40. }
  41. }