Bugfixes
This commit is contained in:
@@ -67,6 +67,14 @@ namespace NavCityBreda
|
||||
}
|
||||
}
|
||||
|
||||
public static CoreDispatcher Dispatcher
|
||||
{
|
||||
get
|
||||
{
|
||||
return Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =========================
|
||||
// STATIC HELPER FUNCTIONS
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
|
||||
using Windows.Devices.Geolocation;
|
||||
using Windows.Devices.Geolocation.Geofencing;
|
||||
using Windows.Services.Maps;
|
||||
using Windows.UI.Core;
|
||||
|
||||
namespace NavCityBreda.Model
|
||||
{
|
||||
@@ -38,10 +39,13 @@ namespace NavCityBreda.Model
|
||||
public enum RouteStatus { STOPPED, STARTED }
|
||||
public RouteStatus Status;
|
||||
|
||||
CoreDispatcher dispatcher;
|
||||
|
||||
public RouteManager()
|
||||
{
|
||||
_routes = new List<Route>();
|
||||
|
||||
dispatcher = App.Dispatcher;
|
||||
|
||||
LoadingElement = "Initializing...";
|
||||
Status = RouteStatus.STOPPED;
|
||||
GeofenceMonitor.Current.GeofenceStateChanged += Current_GeofenceStateChanged;
|
||||
@@ -65,7 +69,10 @@ namespace NavCityBreda.Model
|
||||
|
||||
else if (state == GeofenceState.Entered)
|
||||
{
|
||||
i.Visited = true;
|
||||
dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
|
||||
{
|
||||
i.Visited = true;
|
||||
});
|
||||
_currentlandmark = i;
|
||||
LandmarkVisited(i, LandmarkVisitedEventArgs.VisitedStatus.ENTERED);
|
||||
Util.SendToastNotification(i.Name, "You have visited a landmark.");
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace NavCityBreda.ViewModel
|
||||
|
||||
public MenuVM()
|
||||
{
|
||||
dispatcher = Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher;
|
||||
dispatcher = App.Dispatcher;
|
||||
App.Geo.OnPositionUpdate += Geo_OnPositionUpdate;
|
||||
App.Geo.OnStatusUpdate += Geo_OnStatusUpdate;
|
||||
}
|
||||
|
||||
@@ -57,14 +57,21 @@ namespace NavCityBreda.Views
|
||||
|
||||
private void CompassTracker_OnHeadingUpdated(object sender, HeadingUpdatedEventArgs e)
|
||||
{
|
||||
if (Settings.Tracking && e.Heading.HeadingTrueNorth.HasValue) return;
|
||||
// Map.TryRotateToAsync((double)e.Heading.HeadingTrueNorth);
|
||||
Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
|
||||
{
|
||||
if (Settings.Tracking && e.Heading.HeadingTrueNorth.HasValue) return;
|
||||
// Map.TryRotateToAsync((double)e.Heading.HeadingTrueNorth);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void RouteManager_OnLandmarkVisited(object sender, LandmarkVisitedEventArgs e)
|
||||
{
|
||||
if(e.Status == LandmarkVisitedEventArgs.VisitedStatus.ENTERED)
|
||||
App.MainPage.Navigate(typeof(LandmarkView), e.Landmark);
|
||||
Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
|
||||
{
|
||||
if (e.Status == LandmarkVisitedEventArgs.VisitedStatus.ENTERED)
|
||||
App.MainPage.Navigate(typeof(LandmarkView), e.Landmark);
|
||||
});
|
||||
}
|
||||
|
||||
private void RouteManager_OnRouteChanged(object sender, RouteChangedEventArgs e)
|
||||
@@ -116,7 +123,7 @@ namespace NavCityBreda.Views
|
||||
|
||||
foreach(Landmark l in r.Landmarks)
|
||||
{
|
||||
GeofenceMonitor.Current.Geofences.Add(new Geofence(l.Id, new Geocircle(l.Location.Position, 10)));
|
||||
GeofenceMonitor.Current.Geofences.Add(new Geofence(l.Id, new Geocircle(l.Location.Position, 40)));
|
||||
l.UpdateIconImage();
|
||||
Map.MapElements.Add(l.Icon);
|
||||
}
|
||||
@@ -157,7 +164,9 @@ namespace NavCityBreda.Views
|
||||
|
||||
private void Map_MapElementClick(MapControl sender, MapElementClickEventArgs args)
|
||||
{
|
||||
MapIcon i = args.MapElements.Where(p => p is MapIcon).Cast<MapIcon>().First();
|
||||
if (App.RouteManager.Status == RouteManager.RouteStatus.STOPPED) return;
|
||||
|
||||
MapIcon i = args.MapElements.Where(p => p is MapIcon).Cast<MapIcon>().FirstOrDefault();
|
||||
if (i == null) return;
|
||||
|
||||
Waypoint w = App.RouteManager.CurrentRoute.Get(i);
|
||||
|
||||
Reference in New Issue
Block a user