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

Updated marker icons to larger size
Updated point 45 to call end route buttons
Updated point 45 to be geofenced multiple times

Jeroen 10 жил өмнө
parent
commit
2712a3f78f

BIN
Breda-Tour/Assets/poi.png


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

@@ -103,6 +103,7 @@
     <Content Include="Assets\Flag_Icon.png" />
     <Content Include="Assets\Flag_Icon.png" />
     <Content Include="Assets\Map.png" />
     <Content Include="Assets\Map.png" />
     <Content Include="Assets\Map_Icon.png" />
     <Content Include="Assets\Map_Icon.png" />
+    <Content Include="Assets\poi.png" />
     <Content Include="Assets\UitklapIcon1.png" />
     <Content Include="Assets\UitklapIcon1.png" />
     <Content Include="Assets\UitklapIcon2.png" />
     <Content Include="Assets\UitklapIcon2.png" />
     <Content Include="Storage\helpimages\screen_1.png" />
     <Content Include="Storage\helpimages\screen_1.png" />

+ 15 - 2
Breda-Tour/MapScreen/MapPage.xaml

@@ -14,13 +14,26 @@
         <Grid.RowDefinitions>
         <Grid.RowDefinitions>
             <RowDefinition Height="Auto" />
             <RowDefinition Height="Auto" />
             <RowDefinition Height="Auto" />
             <RowDefinition Height="Auto" />
+            <RowDefinition Height="Auto"/>
             <RowDefinition Height="*" />
             <RowDefinition Height="*" />
         </Grid.RowDefinitions>
         </Grid.RowDefinitions>
 
 
         <c:DefaultTopBar x:Uid="MapPagetxtKaart" Header="Kaart" Grid.Row="0"/>
         <c:DefaultTopBar x:Uid="MapPagetxtKaart" Header="Kaart" Grid.Row="0"/>
         <c:DefaultPivotControl x:Name="DefaultPivot" Grid.Row="1"/>
         <c:DefaultPivotControl x:Name="DefaultPivot" Grid.Row="1"/>
-
-        <Maps:MapControl x:Name="Map" Grid.Row="2" MapElementClick="Map_OnMapElementClick"        
+        <StackPanel x:Name="ButtonPanel" Background="White" Grid.Row="2" Visibility="Collapsed" >
+            <StackPanel>
+                <TextBlock FontSize="14" Margin="120,3,0,0">End current route?</TextBlock>
+            </StackPanel>
+            <StackPanel  Orientation="Horizontal">
+                <Button x:Name="YesButton" Click="YesButton_OnClick" Margin="40,10,0,10" Padding="30,10,30,10">
+                    <TextBlock>Yes</TextBlock>
+                </Button>
+                <Button x:Name="NoButton" Click="NoButton_OnClick" Margin="100,10,0,10" Padding="30,10,30,10">
+                    <TextBlock>No</TextBlock>
+                </Button>
+            </StackPanel>
+        </StackPanel>
+        <Maps:MapControl x:Name="Map" Grid.Row="3" MapElementClick="Map_OnMapElementClick"        
        ZoomInteractionMode="GestureAndControl"
        ZoomInteractionMode="GestureAndControl"
        TiltInteractionMode="GestureAndControl"
        TiltInteractionMode="GestureAndControl"
        RotateInteractionMode="GestureAndControl"
        RotateInteractionMode="GestureAndControl"

+ 34 - 3
Breda-Tour/MapScreen/MapPage.xaml.cs

@@ -11,6 +11,7 @@ using Windows.UI.Core;
 using Windows.UI.Xaml.Controls.Maps;
 using Windows.UI.Xaml.Controls.Maps;
 using Breda_Tour.CustomControls;
 using Breda_Tour.CustomControls;
 using Windows.Devices.Geolocation.Geofencing;
 using Windows.Devices.Geolocation.Geofencing;
+using Windows.UI.Xaml;
 using Breda_Tour.Data;
 using Breda_Tour.Data;
 using Breda_Tour.RouteSelectScreen;
 using Breda_Tour.RouteSelectScreen;
 
 
@@ -83,12 +84,21 @@ namespace Breda_Tour.MapScreen
                 {
                 {
                     //Waypoints handeling
                     //Waypoints handeling
                     Waypoint wayp = route.Waypoints.ElementAt(x);
                     Waypoint wayp = route.Waypoints.ElementAt(x);
-                    MapIcon wp = new MapIcon { Location = wayp.Position, Title = (x + 1).ToString() };
+                    MapIcon wp = new MapIcon { Location = wayp.Position, Title = (x + 1).ToString(), Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/poi.png")) };
                     Map.MapElements.Add(wp);
                     Map.MapElements.Add(wp);
                     //Geofencing handeling
                     //Geofencing handeling
                     string name = (x + 1).ToString();
                     string name = (x + 1).ToString();
-                    GeofenceMonitor.Current.Geofences.Add(new Geofence(name, new Geocircle(wayp.Position.Position, 25),
+                    if (name == "45")
+                    {
+                        GeofenceMonitor.Current.Geofences.Add(new Geofence(name,
+                            new Geocircle(wayp.Position.Position, 25),
+                            MonitoredGeofenceStates.Entered, false, TimeSpan.FromSeconds(3)));
+                    }
+                    else
+                    {
+                        GeofenceMonitor.Current.Geofences.Add(new Geofence(name, new Geocircle(wayp.Position.Position, 25),
                         MonitoredGeofenceStates.Entered, true, TimeSpan.FromSeconds(3)));
                         MonitoredGeofenceStates.Entered, true, TimeSpan.FromSeconds(3)));
+                    }
                 }
                 }
             });
             });
         }
         }
@@ -120,7 +130,7 @@ namespace Breda_Tour.MapScreen
             });
             });
         }
         }
 
 
-        private void OnGeofenceStateChange(GeofenceMonitor sender, object args)
+        private async void OnGeofenceStateChange(GeofenceMonitor sender, object args)
         {
         {
             var reports = sender.ReadReports();
             var reports = sender.ReadReports();
             foreach (GeofenceStateChangeReport report in reports)
             foreach (GeofenceStateChangeReport report in reports)
@@ -143,8 +153,29 @@ namespace Breda_Tour.MapScreen
                             new Notification("Waypoint", waypoint.Title);
                             new Notification("Waypoint", waypoint.Title);
                         }
                         }
                     }
                     }
+                    if (geofence.Id == "45")
+                    {
+                        await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
+                        {
+                            ButtonPanel.Visibility = Visibility.Visible;
+                        });
+                    }
                 }
                 }
             }
             }
         }
         }
+
+        private void YesButton_OnClick(object sender, RoutedEventArgs e)
+        {
+            ButtonPanel.Visibility = Visibility.Collapsed;
+            MainPage.RootFrame.Navigate(typeof (RouteSelectPage));
+            Map.MapElements.Clear();
+            Map.Routes.Clear();
+            gps.History.Clear();
+        }
+
+        private void NoButton_OnClick(object sender, RoutedEventArgs e)
+        {
+            ButtonPanel.Visibility = Visibility.Collapsed;
+        }
     }
     }
 }
 }