RouteSelectPage.xaml.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. System.Diagnostics.Debug.WriteLine(CurrentRoutes[0].Language);
  46. }
  47. private void Routes_ItemClick(object sender, ItemClickEventArgs e)
  48. {
  49. Route route = e.ClickedItem as Route;
  50. MainPage.RootFrame.Navigate(typeof(RouteExample), route);
  51. }
  52. private void Page_GotFocus(object sender, RoutedEventArgs e)
  53. {
  54. CurrentRoutes = AllRoutes.GetCurrentRoutes();
  55. }
  56. }
  57. }