Эх сурвалжийг харах

Merge pull request #7 from jancoow/MultiLanguage

Multi language
Janco Kock 10 жил өмнө
parent
commit
d73391d979
32 өөрчлөгдсөн 1042 нэмэгдсэн , 109 устгасан
  1. BIN
      Breda-Tour/Assets/Flag_Icon.png
  2. BIN
      Breda-Tour/Assets/Map.png
  3. BIN
      Breda-Tour/Assets/Map_Icon.png
  4. BIN
      Breda-Tour/Assets/Marker.png
  5. BIN
      Breda-Tour/Assets/UitklapIcon1.png
  6. BIN
      Breda-Tour/Assets/UitklapIcon2.png
  7. 64 0
      Breda-Tour/Breda-Tour.csproj
  8. 1 1
      Breda-Tour/CustomControls/DefaultPivotControl.xaml.cs
  9. 96 0
      Breda-Tour/Data/Gps.cs
  10. 24 0
      Breda-Tour/Data/Picture.cs
  11. 22 5
      Breda-Tour/Data/Route.cs
  12. 21 9
      Breda-Tour/Data/RouteDatabase.cs
  13. 16 16
      Breda-Tour/Data/waypoint.cs
  14. 3 1
      Breda-Tour/MainPage.xaml.cs
  15. 27 0
      Breda-Tour/MapScreen/ImageViewPage.xaml
  16. 49 0
      Breda-Tour/MapScreen/ImageViewPage.xaml.cs
  17. 30 0
      Breda-Tour/MapScreen/MapPage.xaml
  18. 178 0
      Breda-Tour/MapScreen/MapPage.xaml.cs
  19. 53 0
      Breda-Tour/MapScreen/WpDetailPage.xaml
  20. 83 0
      Breda-Tour/MapScreen/WpDetailPage.xaml.cs
  21. 16 0
      Breda-Tour/MultilingualResources/Breda-Tour.en-US.xlf
  22. 12 29
      Breda-Tour/Package.appxmanifest
  23. 32 0
      Breda-Tour/RouteSelectScreen/BoolToString.cs
  24. 33 0
      Breda-Tour/RouteSelectScreen/Converter.cs
  25. 53 0
      Breda-Tour/RouteSelectScreen/RouteExample.xaml
  26. 116 0
      Breda-Tour/RouteSelectScreen/RouteExample.xaml.cs
  27. 30 2
      Breda-Tour/RouteSelectScreen/RouteSelectPage.xaml
  28. 35 2
      Breda-Tour/RouteSelectScreen/RouteSelectPage.xaml.cs
  29. 8 28
      Breda-Tour/SettingsScreen/SettingsPage.xaml.cs
  30. 16 16
      Breda-Tour/Storage/routes/routes.json
  31. 12 0
      Breda-Tour/en-US/Resources.resw
  32. 12 0
      Breda-Tour/nl-NL/Resources.resw

BIN
Breda-Tour/Assets/Flag_Icon.png


BIN
Breda-Tour/Assets/Map.png


BIN
Breda-Tour/Assets/Map_Icon.png


BIN
Breda-Tour/Assets/Marker.png


BIN
Breda-Tour/Assets/UitklapIcon1.png


BIN
Breda-Tour/Assets/UitklapIcon2.png


+ 64 - 0
Breda-Tour/Breda-Tour.csproj

@@ -100,6 +100,37 @@
     </Content>
     <PRIResource Include="en-US\Resources.resw" />
     <None Include="project.json" />
+    <Content Include="Assets\Flag_Icon.png" />
+    <Content Include="Assets\Map.png" />
+    <Content Include="Assets\Map_Icon.png" />
+    <Content Include="Assets\UitklapIcon1.png" />
+    <Content Include="Assets\UitklapIcon2.png" />
+    <Content Include="Storage\Images\1.jpg" />
+    <Content Include="Storage\Images\10.jpg" />
+    <Content Include="Storage\Images\11.jpg" />
+    <Content Include="Storage\Images\12.jpg" />
+    <Content Include="Storage\Images\13.jpg" />
+    <Content Include="Storage\Images\14.jpg" />
+    <Content Include="Storage\Images\15.jpg" />
+    <Content Include="Storage\Images\16.jpg" />
+    <Content Include="Storage\Images\17.jpg" />
+    <Content Include="Storage\Images\18.jpg" />
+    <Content Include="Storage\Images\19.jpg" />
+    <Content Include="Storage\Images\2.jpg" />
+    <Content Include="Storage\Images\20.jpg" />
+    <Content Include="Storage\Images\21.jpg" />
+    <Content Include="Storage\Images\22.jpg" />
+    <Content Include="Storage\Images\23.jpg" />
+    <Content Include="Storage\Images\24.jpg" />
+    <Content Include="Storage\Images\25.jpg" />
+    <Content Include="Storage\Images\26.jpg" />
+    <Content Include="Storage\Images\3.jpg" />
+    <Content Include="Storage\Images\4.jpg" />
+    <Content Include="Storage\Images\5.jpg" />
+    <Content Include="Storage\Images\6.jpg" />
+    <Content Include="Storage\Images\7.jpg" />
+    <Content Include="Storage\Images\8.jpg" />
+    <Content Include="Storage\Images\9.jpg" />
     <Content Include="Storage\helpimages\taal_1.jpg">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
@@ -118,6 +149,7 @@
     <Compile Include="App.xaml.cs">
       <DependentUpon>App.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Data\Picture.cs" />
     <Compile Include="Data\HelpItem.cs" />
     <Compile Include="Data\HelpItemStep.cs" />
     <Compile Include="Data\HelpPageDatabase.cs" />
@@ -130,6 +162,7 @@
     <Compile Include="CustomControls\DefaultTopBar.xaml.cs">
       <DependentUpon>DefaultTopBar.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Data\Gps.cs" />
     <Compile Include="HelpScreen\HelpPage.xaml.cs">
       <DependentUpon>HelpPage.xaml</DependentUpon>
     </Compile>
@@ -139,8 +172,22 @@
     <Compile Include="MainPage.xaml.cs">
       <DependentUpon>MainPage.xaml</DependentUpon>
     </Compile>
+    <Compile Include="MapScreen\ImageViewPage.xaml.cs">
+      <DependentUpon>ImageViewPage.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="MapScreen\MapPage.xaml.cs">
+      <DependentUpon>MapPage.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="MapScreen\WpDetailPage.xaml.cs">
+      <DependentUpon>WpDetailPage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Notification.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="RouteSelectScreen\BoolToString.cs" />
+    <Compile Include="RouteSelectScreen\Converter.cs" />
+    <Compile Include="RouteSelectScreen\RouteExample.xaml.cs">
+      <DependentUpon>RouteExample.xaml</DependentUpon>
+    </Compile>
     <Compile Include="RouteSelectScreen\RouteSelectPage.xaml.cs">
       <DependentUpon>RouteSelectPage.xaml</DependentUpon>
     </Compile>
@@ -159,6 +206,7 @@
   </ItemGroup>
   <ItemGroup>
     <Content Include="Assets\Ags_Logo.png" />
+    <Content Include="Assets\Marker.png" />
     <Content Include="Properties\Default.rd.xml" />
     <Content Include="Assets\LockScreenLogo.scale-200.png" />
     <Content Include="Assets\SplashScreen.scale-200.png" />
@@ -193,6 +241,22 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="RouteSelectScreen\RouteExample.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="MapScreen\ImageViewPage.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="MapScreen\MapPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="MapScreen\WpDetailPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="RouteSelectScreen\RouteSelectPage.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 1 - 1
Breda-Tour/CustomControls/DefaultPivotControl.xaml.cs

@@ -63,7 +63,7 @@ namespace Breda_Tour.CustomControls
 
         private void MapRadioButton_Checked(object sender, RoutedEventArgs e)
         {
-
+            MainPage.RootFrame.Navigate(typeof (MapScreen.MapPage));
         }
 
         private void SettingsRadioButton_Checked(object sender, RoutedEventArgs e)

+ 96 - 0
Breda-Tour/Data/Gps.cs

@@ -0,0 +1,96 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using Windows.Devices.AllJoyn;
+using Windows.Devices.Geolocation;
+using Windows.Devices.Geolocation.Geofencing;
+using Windows.System;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Media.Animation;
+using Breda_Tour.MapScreen;
+
+namespace Breda_Tour.Data
+{
+    public class Gps
+    {
+        private MapPage mapPage;
+        private Geolocator geolocator;
+
+        private Geoposition _position;
+        public Geoposition Position
+        {
+            get { return _position; }
+        }
+
+        public List<BasicGeoposition> History { get; set; }
+
+
+        private PositionStatus _status;
+        public PositionStatus Status
+        {
+            get { return _status; }
+        }
+
+        public Gps(MapPage mapPage)
+        {
+            History = new List<BasicGeoposition>();
+            this.mapPage = mapPage;
+        }
+
+        public async void Start()
+        {
+            var accessStatus = await Geolocator.RequestAccessAsync();
+
+            switch (accessStatus)
+            {
+                case GeolocationAccessStatus.Allowed:
+                    geolocator = new Geolocator { DesiredAccuracyInMeters = 5, MovementThreshold = 2 };
+                    // Subscribe events
+                    geolocator.StatusChanged += OnStatusChanged;
+                    geolocator.PositionChanged += OnPositionChanged;
+                    // Get position
+                    _position = await geolocator.GetGeopositionAsync();
+                    break;
+                case GeolocationAccessStatus.Denied:
+                    _status = PositionStatus.NotAvailable;
+                    geolocator = null;
+                    bool result = await Launcher.LaunchUriAsync(new Uri("ms-settings:privacy-location"));
+                    Refresh();
+                    break;
+                case GeolocationAccessStatus.Unspecified:
+                    _status = PositionStatus.NotAvailable;
+                    break;
+            }
+        }
+
+        private void OnPositionChanged(Geolocator sender, PositionChangedEventArgs args)
+        {
+            _position = args.Position;
+            mapPage.ShowLocaton(_position.Coordinate.Point);
+            //For route history line
+            BasicGeoposition BasicG = _position.Coordinate.Point.Position;
+            History.Add(BasicG);
+            if (History.Count >= 2)
+            {
+                mapPage.DrawWalkingPath(History);
+            }
+        }
+
+        private void OnStatusChanged(Geolocator sender, StatusChangedEventArgs args)
+        {
+            if (args.Status == PositionStatus.Disabled)
+            {
+                _position = null;
+            }
+        }
+
+        public async void Refresh()
+        {
+            if (geolocator != null)
+            {
+                _position = await geolocator.GetGeopositionAsync();
+                mapPage.ShowLocaton(_position.Coordinate.Point);
+            }
+        }
+    }
+}

+ 24 - 0
Breda-Tour/Data/Picture.cs

@@ -0,0 +1,24 @@
+using Windows.UI.ViewManagement;
+
+namespace Breda_Tour.Data
+{
+    public class Picture
+    {
+        private string _source;
+
+        public string Source
+        {
+            get { return _source; }
+        }
+
+        public double Width
+        {
+            get { return ApplicationView.GetForCurrentView().VisibleBounds.Width; }
+        }
+
+        public Picture(string source)
+        {
+            _source = source;
+        }
+    }
+}

+ 22 - 5
Breda-Tour/Data/Route.cs

@@ -3,15 +3,32 @@ using System.Collections.Generic;
 
 namespace Breda_Tour.Data
 {
-    class Route
+    public class Route
     {
-        public String Title {  get; private set; }
-        public List<Waypoint> Waypoints { get; private set; }
+        public String Title { get; private set; }
 
-        public Route(String Title, List<Waypoint> Waypoints)
+        public String Language { get; private set; }
+
+        private List<Waypoint> _waypoints;
+        public List<Waypoint> Waypoints
         {
+            get { return _waypoints; }
+        }
+
+        public Route(String Language, String Title, List<Waypoint> Waypoints)
+        {
+            this.Language = Language;
             this.Title = Title;
-            this.Waypoints = Waypoints;
+            this._waypoints = Waypoints;
         }
+
+        //public void CreateTestWaypoints()
+        //{
+        //    _waypoints.Add(new Waypoint(51.530805, 4.498676, "Test1", 1, new Image("ms-appx:///Assets/1.jpg"))); { description = "4. Als u de brug overgaat, ziet u aan uw linkerhand het Nassau-Baroniemonument. Bij de ingang van het stadspark, het Valkenberg, staat een monument dat u iets vertelt over de wordings- geschiedenis van de stad Breda, maar vooral over de Heren van de stad uit het Huis van Nassau en de 500-jarige band tussen Breda en het Huis van Nassau. Op 3 juli 1905 werd het Nassau-Baronie- monument, zoals het officieel heet, met  veel feestelijk vertoon door Koningin Wilhelmina onthuld. Het beeld herinnert aan het feit, dat in 1404 Graaf Engelbert, de eerste Bredase Nassau en zijn gemalin, Johanna van Polanen, werden ingehuldigd als Heer en Vrouwe van Breda. De ontwerper is de welbekende dr. P.J.H. Cuypers, die o.m. het Rijksmuseum en het Centraal Station in Amsterdam ontwierp. Op dit monument zijn niet alleen de wapenschilden van twintig gemeenten in en rond de Baronie aangebracht maar ook de Leeuw van Nassau die boven alles uittorent met koningskroon, zwaard en wapenschild. In de drie reliëfs is de 'blijde incomste' van Graaf Engelbert en zijn gemalin afgebeeld. De poortersbieden de sleutel van de stad aan." });
+        //    _waypoints.Add(new Waypoint(51.533461, 4.492711, "Test2", 2, null));
+        //    _waypoints.Add(new Waypoint(51.536998, 4.477862, "Test3", 3, null));
+        //    _waypoints.Add(new Waypoint(51.531285, 4.475394, "Test4", 4, null));
+        //    _waypoints.Add(new Waypoint(51.531566, 4.466747, "Test5", 5, null));
+        //}
     }
 }

+ 21 - 9
Breda-Tour/Data/RouteDatabase.cs

@@ -1,6 +1,8 @@
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
 using System.IO;
 using System.Linq;
 using System.Threading.Tasks;
@@ -9,7 +11,7 @@ namespace Breda_Tour.Data
 {
     class RouteDatabase
     {
-        private List<Route> Routes;
+        public List<Route> Routes;
         
         public RouteDatabase()
         {
@@ -19,15 +21,25 @@ namespace Breda_Tour.Data
 
         private void readRoutes()
         {
-            Task.Run(() =>
+
+            string json = File.ReadAllText("Storage/Routes/routes.json");
+            JObject JsonObject = JObject.Parse(json);
+            IList<JToken> JsonList = JsonObject["Routes"].ToList();
+            foreach (JToken route in JsonList)
+            {
+                Routes.Add(JsonConvert.DeserializeObject<Route>(route.ToString()));
+            }
+        }
+
+        public ObservableCollection<Route> GetCurrentRoutes()
+        {
+            ObservableCollection<Route> routes = new ObservableCollection<Route>();
+            foreach (var route in Routes)
             {
-                string json = File.ReadAllText("Storage/Routes/routes.json");
-                JObject JsonObject = JObject.Parse(json);
-                IList<JToken> JsonList = JsonObject["Routes"].ToList();
-                foreach (JToken route in JsonList){
-                   Routes.Add(JsonConvert.DeserializeObject<Route>(route.ToString()));
-                }
-        });
+                if (route.Language == App.Language)
+                    routes.Add(route);
+            }
+            return routes;
         }
     }
 }

+ 16 - 16
Breda-Tour/Data/waypoint.cs

@@ -7,32 +7,32 @@ using Windows.Devices.Geolocation;
 
 namespace Breda_Tour.Data
 {
-    class Waypoint
+    public class Waypoint
     {
-        public Geopoint Position { get; private set; }
+        private Geopoint _position;
+        public Geopoint Position
+        {
+            get { return _position; }
+        }
+
         public String Title { get; private set; }
         public String Description { get; private set; }
-        public List<Image> Photos { get; private set; }
+        public List<Picture> Pictures { get; private set; }
+        public bool FromPreview { get; set; } 
 
-        public Waypoint(float Lat, float Long, String Title, String Description, List<string> pictures)
+        public Waypoint(double Lat, double Long, String Title, String Description, List<string> pictures)
         {
-            this.Position = new Geopoint(new BasicGeoposition() { Altitude = 0, Latitude = Lat, Longitude = Long });
+            this._position = new Geopoint(new BasicGeoposition() { Altitude = 0, Latitude = Lat, Longitude = Long });
             this.Title = Title;
             this.Description = Description;
-            this.Photos = new List<Image>();
+            this.Pictures = new List<Picture>();
             if (pictures != null)
             {
-                Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
+                foreach (var imageSource in pictures)
                 {
-                    foreach (string source in pictures)
-                    {
-                        Photos.Add(new Image
-                        {
-                            Source = new BitmapImage(new Uri("file://Storages/images/" + source)),
-                            Name = source
-                        });
-                    }
-                });
+                    string newSource = "ms-appx:///Storage/Images/" + imageSource;
+                    Pictures.Add(new Picture(newSource));
+                }
             }
         }
     }

+ 3 - 1
Breda-Tour/MainPage.xaml.cs

@@ -14,6 +14,8 @@ using Windows.UI.Xaml.Data;
 using Windows.UI.Xaml.Input;
 using Windows.UI.Xaml.Media;
 using Windows.UI.Xaml.Navigation;
+using Breda_Tour.MapScreen;
+using Breda_Tour.RouteSelectScreen;
 
 // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
 
@@ -30,7 +32,7 @@ namespace Breda_Tour
         {
             this.InitializeComponent();
             f = this.rootFrame;
-            f.Navigate(typeof(SettingsPage));
+            f.Navigate(typeof(RouteSelectPage));
         }
 
         public static Frame RootFrame {

+ 27 - 0
Breda-Tour/MapScreen/ImageViewPage.xaml

@@ -0,0 +1,27 @@
+<Page
+    x:Class="Breda_Tour.MapScreen.ImageViewPage"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:local="using:Breda_Tour.MapScreen"
+    xmlns:c="using:Breda_Tour.CustomControls"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:Maps ="using:Windows.UI.Xaml.Controls.Maps"
+    xmlns:customControls="using:Breda_Tour.CustomControls"
+    mc:Ignorable="d"
+    x:Name="ImageViewer" 
+    >
+
+    <Grid>
+        <ScrollViewer ZoomMode="Enabled"  
+              MinZoomFactor="1" 
+              MaxZoomFactor="4"
+              HorizontalScrollBarVisibility="Hidden"
+              VerticalScrollBarVisibility="Hidden"
+              >
+            <Image Name="Image"  
+            MaxWidth="{Binding DataContext.PageWidth, ElementName=ImageViewer}"
+            MaxHeight="{Binding DataContext.PageHeight, ElementName=ImageViewer}"/>
+        </ScrollViewer>
+    </Grid>
+</Page>

+ 49 - 0
Breda-Tour/MapScreen/ImageViewPage.xaml.cs

@@ -0,0 +1,49 @@
+// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
+
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Windows.UI.Core;
+using Windows.UI.Xaml.Controls.Primitives;
+using Windows.UI.Xaml.Data;
+using Windows.UI.Xaml.Input;
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Navigation;
+using Breda_Tour.Data;
+
+namespace Breda_Tour.MapScreen
+{
+    /// <summary>
+    /// An empty page that can be used on its own or navigated to within a Frame.
+    /// </summary>
+    public sealed partial class ImageViewPage : Page
+    {
+        Waypoint previouswaypoint;
+        public ImageViewPage()
+        {
+            this.InitializeComponent();
+        }
+
+        protected override void OnNavigatedTo(NavigationEventArgs e)
+        {
+            Tuple<ImageSource, Waypoint> parameters = (Tuple<ImageSource, Waypoint>)e.Parameter;
+            this.Image.Source = parameters.Item1;
+            previouswaypoint = parameters.Item2;
+            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
+            SystemNavigationManager.GetForCurrentView().BackRequested += MainPage_BackRequested;
+        }
+
+        private void MainPage_BackRequested(object sender, BackRequestedEventArgs e)
+        {
+            e.Handled = true;
+            SystemNavigationManager.GetForCurrentView().BackRequested -= MainPage_BackRequested;
+            MainPage.RootFrame.Navigate(typeof (WpDetailPage), previouswaypoint);
+        }
+    }
+}

+ 30 - 0
Breda-Tour/MapScreen/MapPage.xaml

@@ -0,0 +1,30 @@
+<Page
+    x:Class="Breda_Tour.MapScreen.MapPage"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:local="using:Breda_Tour.MapScreen"
+    xmlns:c="using:Breda_Tour.CustomControls"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:Maps ="using:Windows.UI.Xaml.Controls.Maps"
+    xmlns:customControls="using:Breda_Tour.CustomControls"
+    mc:Ignorable="d">
+
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="Auto" />
+            <RowDefinition Height="Auto" />
+            <RowDefinition Height="*" />
+        </Grid.RowDefinitions>
+
+        <c:DefaultTopBar x:Uid="MapPagetxtKaart" Header="Kaart" Grid.Row="0"/>
+        <c:DefaultPivotControl x:Name="DefaultPivot" Grid.Row="1"/>
+
+        <Maps:MapControl x:Name="Map" Grid.Row="2" MapElementClick="Map_OnMapElementClick"        
+       ZoomInteractionMode="GestureAndControl"
+       TiltInteractionMode="GestureAndControl"
+       RotateInteractionMode="GestureAndControl"
+       MapServiceToken="P4P2fAwXuk7ndsVIsaaV~uYjur55RgwmLsiwFwd72bQ~ApDRixf1L-0o_kMY8EtBBDm8xe7G2oz1k2-u0HQIATvSp-iiKr5KLNkYc1HF5D5e"/>
+   
+    </Grid>
+</Page>

+ 178 - 0
Breda-Tour/MapScreen/MapPage.xaml.cs

@@ -0,0 +1,178 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Controls.Primitives;
+using Windows.UI.Xaml.Data;
+using Windows.UI.Xaml.Input;
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Navigation;
+using Windows.Devices.Geolocation;
+using Windows.Services.Maps;
+using Windows.Storage.Streams;
+using Windows.UI;
+using Windows.UI.Core;
+using Windows.UI.Xaml.Automation;
+using Windows.UI.Xaml.Controls.Maps;
+using Windows.UI.Xaml.Shapes;
+using Breda_Tour.CustomControls;
+using System.Diagnostics;
+using Windows.Devices.Geolocation.Geofencing;
+using Windows.UI.Xaml.Automation.Peers;
+using Breda_Tour.Data;
+using Breda_Tour.RouteSelectScreen;
+
+// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
+
+namespace Breda_Tour.MapScreen
+{
+    /// <summary>
+    /// An empty page that can be used on its own or navigated to within a Frame.
+    /// </summary>
+    public sealed partial class MapPage : Page
+    {
+        private MapIcon marker;
+        private Geopoint point;
+        private Gps gps;
+        private Route route;
+
+        public MapPage()
+        {
+            GeofenceMonitor.Current.GeofenceStateChanged += OnGeofenceStateChange; 
+            this.NavigationCacheMode = NavigationCacheMode.Enabled;
+            marker = new MapIcon();
+            marker.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Marker.png"));
+            marker.NormalizedAnchorPoint = new Point(0.5, 0.5);
+            gps = new Gps(this);
+            gps.Start();
+            this.InitializeComponent();
+        }
+
+        protected override void OnNavigatedTo(NavigationEventArgs e)
+        {
+            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
+            DefaultPivot.SetCheckedButton(DefaultPivotControl.Tab.Map);
+            if (RouteExample.fromRouteExamp)
+            {
+                RouteExample.fromRouteExamp = false;
+                route = e.Parameter as Route;
+                Map.MapElements.Clear();
+                gps.History.Clear();
+                gps.Refresh();
+                ShowWaypoints(route);
+                //ShowRoute();
+            }
+        }
+
+        public async void ShowLocaton(Geopoint point)
+        {
+            this.point = point;
+            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
+           {
+               Map.Center = point;
+               if (!Map.MapElements.Contains(marker))
+               {
+                   Map.MapElements.Add(marker);
+               }
+               marker.Location = point;
+           });
+            await Map.TrySetViewAsync(point, 17);
+        }
+
+        public async void ShowRoute()
+        {
+            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
+            {
+                Map.Routes.Add(RouteExample.routeView);
+            });
+            //await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
+            //{
+            //    List<Geopoint> geopoints = new List<Geopoint>();
+            //    foreach (Waypoint wayPoint in route.Waypoints)
+            //    {
+            //        geopoints.Add(wayPoint.Position);
+            //    }
+            //    MapRouteFinderResult finder = await MapRouteFinder.GetWalkingRouteFromWaypointsAsync(geopoints);
+            //    if (finder.Status == MapRouteFinderStatus.Success)
+            //    {
+            //        MapRouteView routeView = new MapRouteView(finder.Route);
+            //        routeView.RouteColor = Colors.Firebrick;
+            //        routeView.OutlineColor = Colors.Black;
+            //        Map.Routes.Add(routeView);
+            //    }
+            //});
+        }
+
+        public async void ShowWaypoints(Route route)
+        {
+            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
+            {
+                GeofenceMonitor.Current.Geofences.Clear();
+                for (int x = 0; x < route.Waypoints.Count; x++)
+                {
+                    //Waypoints handeling
+                    Waypoint wayp = route.Waypoints.ElementAt(x);
+                    MapIcon wp = new MapIcon { Location = wayp.Position, Title = (x + 1).ToString() };
+                    Map.MapElements.Add(wp);
+                    //Geofencing handeling
+                    string name = $"Fence {(x + 1).ToString()}";
+                    GeofenceMonitor.Current.Geofences.Add(new Geofence(name,new Geocircle(wayp.Position.Position,10), MonitoredGeofenceStates.Entered, true,TimeSpan.FromSeconds(3)));
+                    Debug.Write("Geofences count: "+ GeofenceMonitor.Current.Geofences.Count);
+                }
+                //foreach (var waypoint in route.WayPoints)
+                //{
+                //    MapIcon wp = new MapIcon() {Location = waypoint.Position, Title = waypoint.number.ToString()};
+                //    Map.MapElements.Add(wp);
+                //}
+            });
+        }
+
+        private void Map_OnMapElementClick(MapControl sender, MapElementClickEventArgs args)
+        {
+            MapIcon Icon = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon;
+            for (int x = 0; x < route.Waypoints.Count; x++)
+            {
+                if (Icon.Title != "")
+                {
+                    if (x + 1 == int.Parse(Icon.Title))
+                    {
+                        MainPage.RootFrame.Navigate(typeof(WpDetailPage), new Tuple < Waypoint, Route >(route.Waypoints.ElementAt(x), route));
+                    }
+                }
+            }
+            //foreach (var waypoint in route.WayPoints)
+            //{
+            //    if (Icon.Title != "")
+            //    {
+            //        if (waypoint.number == int.Parse(Icon.Title))
+            //        {
+            //            MainPage.RootFrame.Navigate(typeof(WpDetailPage), waypoint);
+            //        }
+            //    }
+            //}
+        }
+
+        public async void DrawWalkingPath(List<BasicGeoposition> positions)
+        {
+            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
+            {
+                MapPolyline mapPolyline = new MapPolyline();
+                mapPolyline.StrokeColor = Colors.Blue;
+                mapPolyline.StrokeThickness = 3;
+                mapPolyline.Path = new Geopath(positions);
+                Map.MapElements.Add(mapPolyline);
+            });
+        }
+
+        private void OnGeofenceStateChange(GeofenceMonitor sender, object args)
+        {
+            Debug.Write("Kappa circle entered!!");
+        }
+    }
+}

+ 53 - 0
Breda-Tour/MapScreen/WpDetailPage.xaml

@@ -0,0 +1,53 @@
+<Page
+    x:Class="Breda_Tour.MapScreen.WpDetailPage"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:local="using:Breda_Tour.MapScreen"
+    xmlns:c ="using:Breda_Tour.CustomControls"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:data="using:Breda_Tour.Data"
+    mc:Ignorable="d">
+
+    <Grid Background="White">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition Height="*"/>
+        </Grid.RowDefinitions>
+
+        <c:DefaultTopBar x:Name="NameBar" Grid.Row="0" Header="{x:Bind wp.Title}"/>
+        <ListView Grid.Row="1" ItemsSource="{x:Bind wp.Pictures}"
+                  ScrollViewer.HorizontalScrollMode="Enabled"
+                    ScrollViewer.IsHorizontalRailEnabled="True"
+                    ScrollViewer.VerticalScrollMode="Disabled" HorizontalAlignment="Left" ScrollViewer.HorizontalScrollBarVisibility="Hidden">
+            <ListView.ItemsPanel>
+                <ItemsPanelTemplate>
+                    <StackPanel Orientation="Horizontal"/>
+                </ItemsPanelTemplate>
+            </ListView.ItemsPanel>
+            <ListView.ItemContainerStyle>
+                <Style TargetType="ListViewItem">
+                    <Setter Property="Padding" Value="0"/>
+                    <Setter Property="Margin" Value="0"/>
+                </Style>
+            </ListView.ItemContainerStyle>
+            <ListView.ItemTemplate >
+                <DataTemplate x:DataType="data:Picture">
+                    <Image Source="{x:Bind Source}" Height="{x:Bind Width}" Width="{x:Bind Width}" Stretch="UniformToFill" />
+                </DataTemplate>
+            </ListView.ItemTemplate>
+        </ListView>
+
+        <RelativePanel Grid.Row="2">
+            <TextBlock x:Uid="WpDetailPagetxtBeschrijving" Text="Beschrijving" FontSize="20" Margin="15,15,0,15" />
+            <Line X1="0" X2="{x:Bind Width, Mode=OneTime}" Y1="50" Y2="50" Stroke="Gray" StrokeThickness="2" />
+        </RelativePanel>
+        <RelativePanel Grid.Row="3">
+            <ScrollViewer Margin="15,0,0,0" VerticalScrollBarVisibility="Auto" >
+                <TextBlock HorizontalAlignment="Stretch"  VerticalAlignment="Stretch" TextWrapping="Wrap" Text="{x:Bind wp.Description}"/>
+            </ScrollViewer>
+        </RelativePanel>
+    </Grid>
+</Page>

+ 83 - 0
Breda-Tour/MapScreen/WpDetailPage.xaml.cs

@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Windows.UI.Core;
+using Windows.UI.ViewManagement;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Controls.Primitives;
+using Windows.UI.Xaml.Data;
+using Windows.UI.Xaml.Input;
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Navigation;
+using Breda_Tour.Data;
+using Breda_Tour.RouteSelectScreen;
+
+// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
+
+namespace Breda_Tour.MapScreen
+{
+    /// <summary>
+    /// An empty page that can be used on its own or navigated to within a Frame.
+    /// </summary>
+    public sealed partial class WpDetailPage : Page
+    {
+        private Waypoint wp;
+        private Route route;
+        public double Width { get; }
+
+        public WpDetailPage()
+        {
+            this.InitializeComponent();
+            Width = ApplicationView.GetForCurrentView().VisibleBounds.Width;
+        }
+
+        protected override void OnNavigatedTo(NavigationEventArgs e)
+        {
+            Tuple<Waypoint, Route> t = (Tuple < Waypoint, Route>) e.Parameter;
+            wp = t.Item1;
+            route = t.Item2;
+            this.DataContext = wp;
+            if (wp.FromPreview)
+            {
+                SystemNavigationManager.GetForCurrentView().BackRequested += RouteExample_BackRequested;
+            }
+            else
+            {
+                SystemNavigationManager.GetForCurrentView().BackRequested += MainPage_BackRequested;
+            }
+            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
+            wp.FromPreview = false;
+        }
+
+        private void RouteExample_BackRequested(object sender, BackRequestedEventArgs e)
+        {
+            e.Handled = true;
+            SystemNavigationManager.GetForCurrentView().BackRequested -= RouteExample_BackRequested;
+            MainPage.RootFrame.Navigate(typeof(RouteExample), route);
+        }
+
+        private void MainPage_BackRequested(object sender, BackRequestedEventArgs e)
+        {
+            e.Handled = true;
+            SystemNavigationManager.GetForCurrentView().BackRequested -= MainPage_BackRequested;
+            MainPage.RootFrame.Navigate(typeof(MapPage));
+        }
+
+        private void Image_PointerPressed(object sender, TappedRoutedEventArgs e)
+        {
+            Image i = (Image)sender;
+            MainPage.RootFrame.Navigate(typeof(ImageViewPage), new Tuple<ImageSource, Waypoint>(i.Source, wp));
+        }
+
+        private void Image_Tapped(object sender, TappedRoutedEventArgs e)
+        {
+
+        }
+    }
+}
+

+ 16 - 0
Breda-Tour/MultilingualResources/Breda-Tour.en-US.xlf

@@ -42,6 +42,22 @@
           <source>Help</source>
           <target state="translated" state-qualifier="tm-suggestion">Help</target>
         </trans-unit>
+        <trans-unit id="RouteExamplePagetxtRouteVoorbeeld.Header" translate="yes" xml:space="preserve">
+          <source>Route voorbeeld</source>
+          <target state="translated" state-qualifier="mt-suggestion">Route example</target>
+        </trans-unit>
+        <trans-unit id="RouteExamplePagetxtRouteInformatie.Text" translate="yes" xml:space="preserve">
+          <source>Route informatie</source>
+          <target state="translated" state-qualifier="mt-suggestion">Route information</target>
+        </trans-unit>
+        <trans-unit id="MapPagetxtKaart.Header" translate="yes" xml:space="preserve">
+          <source>Kaart</source>
+          <target state="translated">Map</target>
+        </trans-unit>
+        <trans-unit id="WpDetailPagetxtBeschrijving.Text" translate="yes" xml:space="preserve">
+          <source>Beschrijving</source>
+          <target state="translated" state-qualifier="tm-suggestion">Description</target>
+        </trans-unit>
       </group>
     </body>
   </file>

+ 12 - 29
Breda-Tour/Package.appxmanifest

@@ -1,49 +1,32 @@
 <?xml version="1.0" encoding="utf-8"?>
-
-<Package
-  xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
-  xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
-  xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
-  IgnorableNamespaces="uap mp">
-
-  <Identity
-    Name="322906c3-d44f-4dc7-9bb2-1f0e00fb09e8"
-    Publisher="CN=Paul de Mast"
-    Version="1.0.0.0" />
-
-  <mp:PhoneIdentity PhoneProductId="322906c3-d44f-4dc7-9bb2-1f0e00fb09e8" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
-
+<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
+  <Identity Name="322906c3-d44f-4dc7-9bb2-1f0e00fb09e8" Publisher="CN=Paul de Mast" Version="1.0.0.0" />
+  <mp:PhoneIdentity PhoneProductId="322906c3-d44f-4dc7-9bb2-1f0e00fb09e8" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
   <Properties>
     <DisplayName>Breda-Tour</DisplayName>
     <PublisherDisplayName>Paul de Mast</PublisherDisplayName>
     <Logo>Assets\StoreLogo.png</Logo>
   </Properties>
-
   <Dependencies>
     <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
   </Dependencies>
-
   <Resources>
-    <Resource Language="x-generate"/>
+    <Resource Language="x-generate" />
   </Resources>
-
   <Applications>
-    <Application Id="App"
-      Executable="$targetnametoken$.exe"
-      EntryPoint="Breda_Tour.App">
-      <uap:VisualElements
-        DisplayName="Breda-Tour"
-        Square150x150Logo="Assets\Square150x150Logo.png"
-        Square44x44Logo="Assets\Square44x44Logo.png"
-        Description="Breda-Tour"
-        BackgroundColor="transparent">
-        <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
+    <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Breda_Tour.App">
+      <uap:VisualElements DisplayName="Breda-Tour" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Breda-Tour" BackgroundColor="transparent">
+        <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
+        </uap:DefaultTile>
         <uap:SplashScreen Image="Assets\SplashScreen.png" />
+        <uap:InitialRotationPreference>
+          <uap:Rotation Preference="portrait" />
+        </uap:InitialRotationPreference>
       </uap:VisualElements>
     </Application>
   </Applications>
-
   <Capabilities>
     <Capability Name="internetClient" />
+    <DeviceCapability Name="location" />
   </Capabilities>
 </Package>

+ 32 - 0
Breda-Tour/RouteSelectScreen/BoolToString.cs

@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Windows.UI.Xaml.Data;
+
+namespace Breda_Tour.RouteSelectScreen
+{
+    class BoolToString : IValueConverter
+    {
+        private object GetString(object value)
+        {
+            if (!(value is bool))
+                return "ms-appx:///Assets/UitklapIcon1.png";
+            bool objValue = (bool)value;
+            if (objValue)
+            {
+                return "ms-appx:///Assets/UitklapIcon2.png";
+            }
+            return "ms-appx:///Assets/UitklapIcon1.png";
+        }
+        public object Convert(object value, Type targetType, object parameter, string language)
+        {
+            return GetString(value);
+        }
+        public object ConvertBack(object value, Type targetType, object parameter, string language)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 33 - 0
Breda-Tour/RouteSelectScreen/Converter.cs

@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Data;
+
+namespace Breda_Tour.RouteSelectScreen
+{
+    class Converter :IValueConverter
+    {
+        private object GetVisibility(object value)
+        {
+            if (!(value is bool))
+                return Visibility.Collapsed;
+            bool objValue = (bool)value;
+            if (objValue)
+            {
+                return Visibility.Visible;
+            }
+            return Visibility.Collapsed;
+        }
+        public object Convert(object value, Type targetType, object parameter, string language)
+        {
+            return GetVisibility(value);
+        }
+        public object ConvertBack(object value, Type targetType, object parameter, string language)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 53 - 0
Breda-Tour/RouteSelectScreen/RouteExample.xaml

@@ -0,0 +1,53 @@
+<Page
+    x:Class="Breda_Tour.RouteSelectScreen.RouteExample"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:local="using:Breda_Tour.RouteSelectScreen"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:c="using:Breda_Tour.CustomControls"
+    xmlns:data="using:Breda_Tour.Data"
+    mc:Ignorable="d">
+
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition Height="*"/>
+        </Grid.RowDefinitions>
+
+        <c:DefaultTopBar Grid.Row="0" x:Uid="RouteExamplePagetxtRouteVoorbeeld" Header="Routevoorbeeld"/>
+
+        <StackPanel Grid.Row="1">
+            <StackPanel Orientation="Horizontal" Margin="10,10,0,0">
+                <TextBlock x:Uid="RouteExamplePagetxtRouteInformatie" Text="Route informatie" FontSize="16"/>
+                <Button x:Name="StartButton" Visibility="Collapsed" Click="Button_Click" Margin="120,0,0,0" >
+                    <TextBlock Text="Start Route"/>
+                </Button>
+            </StackPanel>
+            <TextBlock x:Name="RouteBlok" FontSize="16" Margin="10,0,0,0"/>
+            <ProgressRing x:Name="ProgressRing" Height="40" Width="40" IsActive="True" HorizontalAlignment="Left" Margin="20,0,0,0" Foreground="Black"/>
+            <TextBlock x:Name="Loopblok" FontSize="16" Margin="10,0,0,0" />
+            <TextBlock x:Name="WaypointsBlok" FontSize="16" Margin="10,0,0,10"/>
+
+        </StackPanel>
+        <StackPanel Grid.Row="2">
+            <Image Source="ms-appx:///Assets/Map.png" Width="360"  />
+        </StackPanel>
+
+        <ListView Grid.Row="3" Margin="10,0,0,0" x:Name="Waypoints" ItemsSource="{x:Bind route.Waypoints}" IsItemClickEnabled="True" ItemClick="Waypoints_OnItemClick">
+            <ListView.ItemContainerStyle>
+                <Style TargetType="ListViewItem">
+                    <Setter Property="Padding" Value="0"/>
+                    <Setter Property="Margin" Value="0"/>
+                </Style>
+            </ListView.ItemContainerStyle>
+            <ListView.ItemTemplate >
+                <DataTemplate x:DataType="data:Waypoint">
+                    <TextBlock Text="{x:Bind Title}" />
+                </DataTemplate>
+            </ListView.ItemTemplate>
+        </ListView>
+    </Grid>
+</Page>

+ 116 - 0
Breda-Tour/RouteSelectScreen/RouteExample.xaml.cs

@@ -0,0 +1,116 @@
+using Breda_Tour.Data;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Devices.Geolocation;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Windows.Services.Maps;
+using Windows.UI;
+using Windows.UI.Core;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Controls.Maps;
+using Windows.UI.Xaml.Controls.Primitives;
+using Windows.UI.Xaml.Data;
+using Windows.UI.Xaml.Input;
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Navigation;
+using Breda_Tour.MapScreen;
+
+// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
+
+namespace Breda_Tour.RouteSelectScreen
+{
+    /// <summary>
+    /// An empty page that can be used on its own or navigated to within a Frame.
+    /// </summary>
+    public sealed partial class RouteExample : Page
+    {
+        Route route;
+        public string WaypointsText { get; set; }
+        public string RouteTijdText { get; set; }
+        public string LoopafstandText { get; set; }
+        public static bool fromRouteExamp;
+        public static MapRouteView routeView;
+
+        public RouteExample()
+        {
+            MapService.ServiceToken =
+                "P4P2fAwXuk7ndsVIsaaV~uYjur55RgwmLsiwFwd72bQ~ApDRixf1L-0o_kMY8EtBBDm8xe7G2oz1k2-u0HQIATvSp-iiKr5KLNkYc1HF5D5e";
+            InitializeComponent();
+        }
+
+        protected override void OnNavigatedTo(NavigationEventArgs e)
+        {
+        
+            route = e.Parameter as Route;
+            ShowRouteInfo();
+            //Setting the back button functionality
+            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
+            SystemNavigationManager.GetForCurrentView().BackRequested += BackRequested;
+            
+        }
+
+        private void BackRequested(object sender, BackRequestedEventArgs e)
+        {
+            e.Handled = true;
+            SystemNavigationManager.GetForCurrentView().BackRequested -= BackRequested;
+            MainPage.RootFrame.Navigate(typeof(RouteSelectPage));
+        }
+
+        private void Button_Click(object sender, RoutedEventArgs e)
+        {
+            fromRouteExamp = true;
+            MainPage.RootFrame.Navigate(typeof(MapPage), route);
+        }
+
+        private async void ShowRouteInfo()
+        {
+            //Setting the x amount of waypoints text
+            WaypointsText = "Aantal waypoints: " + 0;
+            if (route.Waypoints.Count != 0)
+            {
+                WaypointsText = "Aantal waypoints: " + route.Waypoints.Count;
+            }
+            //Setting the Route distance and time text
+            List<Geopoint> geopoints = new List<Geopoint>();
+            foreach (Waypoint wayPoint in route.Waypoints)
+            {
+                geopoints.Add(wayPoint.Position);
+            }
+            MapRouteFinderResult finder = await MapRouteFinder.GetWalkingRouteFromWaypointsAsync(geopoints);
+            Debug.Write("Finder status: " + finder.Status);
+            if (finder.Status == MapRouteFinderStatus.Success)
+            {
+                //Create route for mapPage
+                routeView = new MapRouteView(finder.Route);
+                routeView.RouteColor = Colors.Firebrick;
+                routeView.OutlineColor = Colors.Black;
+                //route duration
+                int tijd = ((int) finder.Route.EstimatedDuration.TotalMinutes);
+                RouteTijdText = $"Tijdsduur: {tijd} min";
+                RouteBlok.Text = RouteTijdText;
+                //Route distance
+                LoopafstandText = $"Loopafstand: {(Convert.ToInt32(finder.Route.LengthInMeters/1000))} km";
+                Loopblok.Text = LoopafstandText;
+                //Waypoint text
+                WaypointsBlok.Text = WaypointsText;
+                ProgressRing.Visibility = Visibility.Collapsed;
+                StartButton.Visibility = Visibility.Visible;
+            }
+            StartButton.Visibility = Visibility.Visible;
+        }
+
+        private void Waypoints_OnItemClick(object sender, ItemClickEventArgs e)
+        {
+            Waypoint wp = e.ClickedItem as Waypoint;
+            wp.FromPreview = true;
+            Tuple<Waypoint, Route> t = new Tuple<Waypoint, Route>(wp, route);
+            MainPage.RootFrame.Navigate(typeof(WpDetailPage),t);
+        }
+    }
+}

+ 30 - 2
Breda-Tour/RouteSelectScreen/RouteSelectPage.xaml

@@ -6,7 +6,10 @@
     xmlns:c="using:Breda_Tour.CustomControls"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-    mc:Ignorable="d">
+    xmlns:data="using:Breda_Tour.Data"
+    xmlns:con="using:Breda_Tour.RouteSelectScreen"
+    mc:Ignorable="d" GotFocus="Page_GotFocus">
+
 
     <Grid>
         <Grid.RowDefinitions>
@@ -16,6 +19,31 @@
         </Grid.RowDefinitions>
         <c:DefaultTopBar x:Uid="RouteSelectPagetxtSelectRoute" Header="Route Selecteren"/>
         <c:DefaultPivotControl x:Name="DefaultPivot" Grid.Row="1"/>
-        
+        <RelativePanel Grid.Row="2" Margin="0,5">
+            <RelativePanel.Resources>
+                <con:Converter x:Key="BoolToVis"/>
+                <con:BoolToString x:Key="BoolToString"/>
+            </RelativePanel.Resources>
+            <ListView x:Name="Routes" ItemsSource="{x:Bind CurrentRoutes}" IsItemClickEnabled="True" ItemClick="Routes_ItemClick">
+                <ListView.ItemTemplate>
+                    <DataTemplate x:DataType="data:Route">
+                        <StackPanel>
+                            <StackPanel Orientation="Horizontal" Width="340">
+                                <Image Source="ms-appx:///Assets/Map_Icon.png" Width="35" Height="35"/>
+                                <TextBlock Text="{Binding Title}" FontSize="24" Margin="15,0,0,0"/>
+                                <ToggleButton x:Name="toggleButton" Background="Transparent" IsChecked="False" Width="40" Height="40" Margin="35,0,0,0">
+                                    <Image Source="{Binding Path=IsChecked, ElementName=toggleButton,Converter={StaticResource BoolToString}}" Height="29" Margin="-10,0,-9,-1"/>
+                                </ToggleButton>
+                            </StackPanel>
+                            <StackPanel Orientation="Horizontal" Width="340" Visibility="{Binding Path=IsChecked, ElementName=toggleButton,Converter={StaticResource BoolToVis}}">
+                                <Image Source="ms-appx:///Assets/Flag_Icon.png" Width="25" Height="25" Margin="45,0,0,0"/>
+                                <TextBlock Text="Breda" Foreground="DarkGray" FontSize="16" Margin="15,0,0,0"/>
+                            </StackPanel>
+                            <Line X1="0" X2="1080" Y1="5" Y2="5" Stroke="Gray" StrokeThickness="2"/>
+                        </StackPanel>
+                    </DataTemplate>
+                </ListView.ItemTemplate>
+            </ListView>
+        </RelativePanel>
     </Grid>
 </Page>

+ 35 - 2
Breda-Tour/RouteSelectScreen/RouteSelectPage.xaml.cs

@@ -1,10 +1,13 @@
-using System;
+using Breda_Tour.Data;
+using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.IO;
 using System.Linq;
 using System.Runtime.InteropServices.WindowsRuntime;
 using Windows.Foundation;
 using Windows.Foundation.Collections;
+using Windows.UI.Core;
 using Windows.UI.Xaml;
 using Windows.UI.Xaml.Controls;
 using Windows.UI.Xaml.Controls.Primitives;
@@ -22,10 +25,40 @@ namespace Breda_Tour.RouteSelectScreen
     /// </summary>
     public sealed partial class RouteSelectPage : Page
     {
+        RouteDatabase AllRoutes;
+
+        public ObservableCollection<Route> CurrentRoutes
+        {
+            get { return (ObservableCollection<Route>)GetValue(HelpItemProperty); }
+            set { SetValue(HelpItemProperty, value); }
+        }
+        public static readonly DependencyProperty HelpItemProperty =
+        DependencyProperty.Register("CurrentRoutes", typeof(ObservableCollection<Route>), typeof(RouteSelectPage), null);
+
         public RouteSelectPage()
         {
+            AllRoutes = new RouteDatabase();
+            CurrentRoutes = AllRoutes.GetCurrentRoutes();
             this.InitializeComponent();
             DefaultPivot.SetCheckedButton(CustomControls.DefaultPivotControl.Tab.RouteSelected);
         }
+
+        protected override void OnNavigatedTo(NavigationEventArgs e)
+        {
+            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
+            CurrentRoutes = AllRoutes.GetCurrentRoutes();
+            System.Diagnostics.Debug.WriteLine(CurrentRoutes[0].Language);
+        }
+
+        private void Routes_ItemClick(object sender, ItemClickEventArgs e)
+        {
+            Route route = e.ClickedItem as Route;
+            MainPage.RootFrame.Navigate(typeof(RouteExample), route);
+        }
+
+        private void Page_GotFocus(object sender, RoutedEventArgs e)
+        {
+            CurrentRoutes = AllRoutes.GetCurrentRoutes();
+        }
     }
-}
+}

+ 8 - 28
Breda-Tour/SettingsScreen/SettingsPage.xaml.cs

@@ -1,54 +1,34 @@
 using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
 using Breda_Tour;
-
-using Breda_Tour.HelpScreen;
-using Breda_Tour.Data;
-using Windows.Foundation;
-using Windows.Foundation.Collections;
-using Windows.UI.Xaml;
 using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Controls.Primitives;
-using Windows.UI.Xaml.Data;
 using Windows.UI.Xaml.Input;
-using Windows.UI.Xaml.Media;
-using Windows.UI.Xaml.Navigation;
-using Windows.Globalization;
+using System.Threading.Tasks;
 using Breda_Tour.SplashScreen;
 
-// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
-
 namespace Breda_Tours.SettingsScreen
 {
-    /// <summary>
-    /// An empty page that can be used on its own or navigated to within a Frame.
-    /// </summary>
     public sealed partial class SettingsPage : Page
     {
-     public SettingsPage()
+       public SettingsPage()
         {
             this.InitializeComponent();
+
             DefaultPivot.SetCheckedButton(Breda_Tour.CustomControls.DefaultPivotControl.Tab.Settings);
         }
-
-
 		
-        private void listViewItemSetupLanguage_Tapped(object sender, TappedRoutedEventArgs e)
+        private async void listViewItemSetupLanguage_Tapped(object sender, TappedRoutedEventArgs e)
         {
             if (App.Language == App.Languages[0])
             {
                 App.Language = App.Languages[1];
-                Frame.Navigate(typeof(MainPage));
+                await Task.Delay(TimeSpan.FromMilliseconds(50));
+                MainPage.RootFrame.Navigate(typeof(SettingsPage));
             }
             else
             {
                 App.Language = App.Languages[0];
-                Frame.Navigate(typeof(MainPage));
+                await Task.Delay(TimeSpan.FromMilliseconds(50));
+                MainPage.RootFrame.Navigate(typeof(SettingsPage));
             }
         }
         private void listViewItemReset_Tapped(object sender, TappedRoutedEventArgs e)

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 16 - 16
Breda-Tour/Storage/routes/routes.json


+ 12 - 0
Breda-Tour/en-US/Resources.resw

@@ -39,4 +39,16 @@
   <data name="HelpScreenPagetxtHelpScreen.Header" xml:space="preserve">
     <value>Help</value>
   </data>
+  <data name="RouteExamplePagetxtRouteVoorbeeld.Header" xml:space="preserve">
+    <value>Route example</value>
+  </data>
+  <data name="RouteExamplePagetxtRouteInformatie.Text" xml:space="preserve">
+    <value>Route information</value>
+  </data>
+  <data name="MapPagetxtKaart.Header" xml:space="preserve">
+    <value>Map</value>
+  </data>
+  <data name="WpDetailPagetxtBeschrijving.Text" xml:space="preserve">
+    <value>Description</value>
+  </data>
 </root>

+ 12 - 0
Breda-Tour/nl-NL/Resources.resw

@@ -141,7 +141,19 @@
   <data name="HelpScreenPagetxtHelpScreen.Header" xml:space="preserve">
     <value>Help</value>
   </data>
+  <data name="MapPagetxtKaart.Header" xml:space="preserve">
+    <value>Map</value>
+  </data>
+  <data name="RouteExamplePagetxtRouteInformatie.Text" xml:space="preserve">
+    <value>Route informatie</value>
+  </data>
+  <data name="RouteExamplePagetxtRouteVoorbeeld.Header" xml:space="preserve">
+    <value>Route voorbeeld</value>
+  </data>
   <data name="RouteSelectPagetxtSelectRoute.Header" xml:space="preserve">
     <value>Route selecteren</value>
   </data>
+  <data name="WpDetailPagetxtBeschrijving.Text" xml:space="preserve">
+    <value>Beschrijving</value>
+  </data>
 </root>

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно