private async Task CheckLocationPermissions() { if (IsBusy) { return; } IsBusy = true; try { // Check permissions before var locationPermissions = await CsExtensions.CheckPermissions(new Permissions.LocationAlways()); switch (locationPermissions) { case PermissionStatus.Granted: await Application.Current.MainPage.Navigation.PushAsync(new MapToGraph()); break; } } catch (Exception e) { Console.WriteLine( $"{nameof(MainPageViewModel)}:{nameof(CheckLocationPermissions)} - Exception -- {e.Message}, Stack: {e.StackTrace}"); } finally { IsBusy = false; } }
private void LoadCurrentRoute(List <RoutePoint> routePoints) { var line = CreatePolyline(new Route { Color = Globals.DefaultColor.ToHex(), RoutePointsBlob = CsExtensions.CompactRoutePointList(routePoints) }); MyMap.MapElements.Add(line); }
public Task <int> SaveRoute(List <RoutePoint> wayPoints) { if (wayPoints == null || wayPoints.Count < 1) { return(Task.FromResult(0)); } var route = new Route { Color = RandColor.ToHex(), RoutePointsBlob = CsExtensions.CompactRoutePointList(wayPoints) }; return(Database.InsertAsync(route)); }