HelpPage.xaml.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using Breda_Tour.Data;
  2. using Breda_Tours.SettingsScreen;
  3. using System;
  4. using System.Collections.Generic;
  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.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. // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
  18. namespace Breda_Tour.HelpScreen
  19. {
  20. /// <summary>
  21. /// An empty page that can be used on its own or navigated to within a Frame.
  22. /// </summary>
  23. public sealed partial class HelpPage : Page
  24. {
  25. HelpItem helpitem;
  26. int currentpage;
  27. public HelpPage()
  28. {
  29. this.InitializeComponent();
  30. }
  31. protected override void OnNavigatedTo(NavigationEventArgs e)
  32. {
  33. helpitem = ((HelpItem)e.Parameter);
  34. SetPage(0);
  35. Topbar.Header = helpitem.Title;
  36. }
  37. private void SetPage(int pagenumber)
  38. {
  39. if(pagenumber >= 0 && pagenumber < helpitem.HelpItemSteps.Count)
  40. {
  41. currentpage = pagenumber;
  42. this.DataContext = helpitem.HelpItemSteps[currentpage];
  43. PageNumberTextBlock.Text = "Page " + (currentpage+1) + " of " + helpitem.HelpItemSteps.Count;
  44. }
  45. }
  46. private void Close_Tapped(object sender, TappedRoutedEventArgs e)
  47. {
  48. MainPage.RootFrame.Navigate(typeof(SettingsPage));
  49. }
  50. private void PageBack_Tapped(object sender, TappedRoutedEventArgs e)
  51. {
  52. SetPage(currentpage - 1);
  53. }
  54. private void PageForward_Tapped(object sender, TappedRoutedEventArgs e)
  55. {
  56. SetPage(currentpage + 1);
  57. }
  58. }
  59. }