Bugfixes and improvements
This commit is contained in:
@@ -241,7 +241,7 @@
|
||||
<value>WiFi</value>
|
||||
</data>
|
||||
<data name="RouteIn" xml:space="preserve">
|
||||
<value>in</value>
|
||||
<value>In</value>
|
||||
</data>
|
||||
<data name="LandmarkReached" xml:space="preserve">
|
||||
<value>You have reached a landmark</value>
|
||||
|
||||
@@ -241,7 +241,7 @@
|
||||
<value>Keer indien mogelijk om</value>
|
||||
</data>
|
||||
<data name="RouteIn" xml:space="preserve">
|
||||
<value>over</value>
|
||||
<value>Over</value>
|
||||
</data>
|
||||
<data name="LandmarkReached" xml:space="preserve">
|
||||
<value>U heeft een bezienswaardigheid bereikt</value>
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
VerticalAlignment="Stretch">
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Name="BackMessage" Background="LightGray" Opacity="0.5" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="0,0,0,40" Visibility="Collapsed" Height="Auto">
|
||||
<StackPanel Name="BackMessage" Background="LightGray" Opacity="0.7" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="0,0,0,40" Visibility="Collapsed" Height="Auto">
|
||||
<TextBlock Text="{Binding BackText}" Margin="5" HorizontalAlignment="Center" TextAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace NavCityBreda.Model
|
||||
case GeolocationAccessStatus.Allowed:
|
||||
geo = new Geolocator {
|
||||
DesiredAccuracy = PositionAccuracy.High,
|
||||
MovementThreshold = 5
|
||||
MovementThreshold = 3
|
||||
//ReportInterval = 1500
|
||||
};
|
||||
|
||||
|
||||
@@ -48,6 +48,8 @@ namespace NavCityBreda.Model
|
||||
private MapRouteManeuver _currentmaneuver;
|
||||
private List<MapRouteManeuver> _currentmaneuvers { get { return _currentrouteleg.Maneuvers.ToList(); } }
|
||||
public MapRouteManeuver CurrentManeuver { get { return _currentmaneuver; } }
|
||||
public int DistanceToManeuver { get; private set; }
|
||||
|
||||
|
||||
public string LoadingElement;
|
||||
|
||||
@@ -63,6 +65,7 @@ namespace NavCityBreda.Model
|
||||
|
||||
LoadingElement = Util.Loader.GetString("Initializing") + "...";
|
||||
Status = RouteStatus.LOADING;
|
||||
DistanceToManeuver = -1;
|
||||
GeofenceMonitor.Current.GeofenceStateChanged += Current_GeofenceStateChanged;
|
||||
App.Geo.OnPositionUpdate += Geo_OnPositionUpdate;
|
||||
LoadRoutes();
|
||||
@@ -85,7 +88,7 @@ namespace NavCityBreda.Model
|
||||
double dif_lat = Math.Abs(_currentroutelegs[q].Maneuvers[i].StartingPoint.Position.Latitude - e.New.Coordinate.Point.Position.Latitude);
|
||||
double dif_lon = Math.Abs(_currentroutelegs[q].Maneuvers[i].StartingPoint.Position.Longitude - e.New.Coordinate.Point.Position.Longitude);
|
||||
|
||||
if (dif_lat < 0.00003 || dif_lon < 0.00003)
|
||||
if (dif_lat < 0.000025 || dif_lon < 0.000025)
|
||||
{
|
||||
_currentroutelegcount = q;
|
||||
_currentmaneuvercount = i + 1;
|
||||
@@ -113,9 +116,10 @@ namespace NavCityBreda.Model
|
||||
if (_currentmaneuver != _currentmaneuvers[_currentmaneuvercount])
|
||||
{
|
||||
_currentmaneuver = _currentmaneuvers[_currentmaneuvercount];
|
||||
UpdateManeuver(_currentmaneuver);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateManeuver(_currentmaneuver);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +148,7 @@ namespace NavCityBreda.Model
|
||||
});
|
||||
_currentlandmark = i;
|
||||
LandmarkVisited(i, LandmarkVisitedEventArgs.VisitedStatus.ENTERED);
|
||||
Util.SendToastNotification(i.Name, Util.Loader.GetString("LandmarkReached"));
|
||||
Util.ShowToastNotification(i.Name, Util.Loader.GetString("LandmarkReached"));
|
||||
UpdateRoute();
|
||||
}
|
||||
|
||||
@@ -214,6 +218,7 @@ namespace NavCityBreda.Model
|
||||
_currentmaneuvercount = 0;
|
||||
_currentmaneuver = _currentmaneuvers[_currentmaneuvercount];
|
||||
|
||||
|
||||
//Send out events
|
||||
UpdateRoute(_routetolandmark, _currentlandmark);
|
||||
UpdateManeuver(_currentmaneuver);
|
||||
@@ -268,6 +273,16 @@ namespace NavCityBreda.Model
|
||||
return l;
|
||||
}
|
||||
|
||||
private async Task<int> DistanceToCurrentManeuver()
|
||||
{
|
||||
if (_currentmaneuver == null) return -1;
|
||||
if (App.Geo.Position == null) return -1;
|
||||
|
||||
MapRoute route = await Util.FindWalkingRoute(App.Geo.Position.Coordinate.Point, _currentmaneuver.StartingPoint);
|
||||
|
||||
return (int)route.LengthInMeters;
|
||||
}
|
||||
|
||||
public async Task<String> Reset()
|
||||
{
|
||||
foreach(Route r in _routes)
|
||||
@@ -305,8 +320,10 @@ namespace NavCityBreda.Model
|
||||
OnLandmarkChanged(this, new LandmarkChangedEventArgs(route, l));
|
||||
}
|
||||
|
||||
private void UpdateManeuver(MapRouteManeuver curman)
|
||||
private async void UpdateManeuver(MapRouteManeuver curman)
|
||||
{
|
||||
DistanceToManeuver = await DistanceToCurrentManeuver();
|
||||
|
||||
// Make sure someone is listening to event
|
||||
if (OnManeuverChanged == null) return;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace NavCityBreda.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
return landmark == App.RouteManager.CurrentLandmark;
|
||||
return landmark == App.RouteManager.CurrentLandmark && landmark.Status == Landmark.LandmarkStatus.NOTVISITED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace NavCityBreda.ViewModels
|
||||
get
|
||||
{
|
||||
if (App.RouteManager.CurrentManeuver != null)
|
||||
return Util.TranslatedManeuver(App.RouteManager.CurrentManeuver);
|
||||
return Util.TranslatedManeuver(App.RouteManager.CurrentManeuver, App.RouteManager.DistanceToManeuver);
|
||||
else
|
||||
return Util.Loader.GetString("Unknown");
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@
|
||||
|
||||
<Grid Grid.Row="1" Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="40*" />
|
||||
<ColumnDefinition Width="25*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
|
||||
@@ -151,8 +151,8 @@ namespace NavCityBreda.Views
|
||||
|
||||
foreach (Landmark l in r.Landmarks)
|
||||
{
|
||||
if (l.Status == Landmark.LandmarkStatus.NOTVISITED)
|
||||
GeofenceMonitor.Current.Geofences.Add(new Geofence(l.Id, new Geocircle(l.Position.Position, 35), MonitoredGeofenceStates.Entered, true));
|
||||
if (l.Status != Landmark.LandmarkStatus.VISITED)
|
||||
GeofenceMonitor.Current.Geofences.Add(new Geofence(l.Id, new Geocircle(l.Position.Position, 25), MonitoredGeofenceStates.Entered, true));
|
||||
l.UpdateIcon();
|
||||
await Task.Delay(TimeSpan.FromMilliseconds(3));
|
||||
Map.MapElements.Add(l.Icon);
|
||||
@@ -191,10 +191,10 @@ namespace NavCityBreda.Views
|
||||
|
||||
if (mapvm.Tracking)
|
||||
{
|
||||
if (Map.Pitch != 55)
|
||||
if (Map.Pitch != 35)
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromMilliseconds(300));
|
||||
await Map.TryTiltToAsync(55);
|
||||
await Map.TryTiltToAsync(35);
|
||||
}
|
||||
|
||||
if (App.CompassTracker.Heading != null && App.CompassTracker.Heading.HeadingTrueNorth.HasValue)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Name="ResetButton" Click="ResetButton_Click">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock FontFamily="Segoe MDL2 Assets" Text="" Margin="0,0,10,0" />
|
||||
<TextBlock FontFamily="Segoe MDL2 Assets" Text="" Margin="0,3,10,0" />
|
||||
<TextBlock Text="{Binding Reset}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
@@ -77,16 +77,9 @@ namespace NavCityBreda.Views
|
||||
|
||||
private async void ResetButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageDialog dlg = new MessageDialog(Util.Loader.GetString("ResetConfirmation"), Util.Loader.GetString("Reset"));
|
||||
dlg.Commands.Add(new UICommand(Util.Loader.GetString("Yes")) { Id = 1 } );
|
||||
dlg.Commands.Add(new UICommand(Util.Loader.GetString("No")) { Id = 0 });
|
||||
bool confirm = await Util.ShowConfirmDialog(Util.Loader.GetString("Reset"), Util.Loader.GetString("ResetConfirmation"), Util.DialogType.YESNO);
|
||||
|
||||
dlg.DefaultCommandIndex = 0;
|
||||
dlg.CancelCommandIndex = 1;
|
||||
|
||||
var result = await dlg.ShowAsync();
|
||||
|
||||
if((int)result.Id == 1)
|
||||
if(confirm)
|
||||
{
|
||||
ResetProgress.IsActive = true;
|
||||
App.RouteManager.StopRoute();
|
||||
|
||||
Reference in New Issue
Block a user