public MapPage(IGeolocatorService geolocatorService) { InitializeComponent(); _geolocatorService = geolocatorService; MoveMapToCurrentPositionAsync(); }
public CountryPage( IGeolocatorService geolocatorService) { InitializeComponent(); _geolocatorService = geolocatorService; MoveMapToCurrentCountryAsync(); }
public StartTripPage(IGeolocatorService geolocatorService) { InitializeComponent(); _geolocatorService = geolocatorService; _instance = this; _distance = .2; }
public MainMapViewModel( IRequestService requestService, ILayerService layerService, IGeolocatorService geolocatorService, INavigationService navigationService, IHexagonal hexagonal, IHeatGradientService heatGradientService, IZoneService zoneService) { _requestService = requestService; _layerService = layerService; _geolocatorService = geolocatorService; _navigationService = navigationService; _hexagonal = hexagonal; _heatGradientService = heatGradientService; _zoneService = zoneService; Initialized = false; _layerLast = 0; _currentPositionTag = String.Empty; _currentPosition = _geolocatorService.LastRecordedPosition; //MainMapInitialCameraUpdate = CameraUpdateFactory.NewPositionZoom(_currentPosition, 12.0); // zoom can be within: [2,21] CameraPosition cp = new CameraPosition(_currentPosition, 12.0, 0.0, 60.0); MainMapInitialCameraUpdate = CameraUpdateFactory.NewCameraPosition(cp); }
/// <summary> /// Observes the location permission. /// </summary> public static IObservable <bool> ObserveIsPermissionGranted(this IGeolocatorService service) { return(Observable.FromEventPattern <LocationPermissionChangedEventHandler, LocationPermissionChangedEventArgs>( h => service.LocationPermissionChanged += h, h => service.LocationPermissionChanged -= h ) .Select(p => p.EventArgs.IsLocationPermissionGranted)); }
/// <summary> /// Observes the user's location. /// </summary> public static IObservable <Geocoordinate> ObserveLocation(this IGeolocatorService service) { return(Observable.FromEventPattern <LocationChangedEventHandler, LocationChangedEventArgs> ( h => service.LocationChanged += h, h => service.LocationChanged -= h ) .Select(p => p.EventArgs.Coordinate)); }
private static async Task GetInitialLocationOrDefault(this IGeolocatorService service, IObserver <Geocoordinate> observer, CancellationToken ct) { var isPermissionGranted = await service.RequestPermission(ct); var currentLocationOrNull = isPermissionGranted ? await service.GetLocationOrDefault(ct) : null; observer.OnNext(currentLocationOrNull); }
public ParkPage(IGeolocatorService geolocatorService, IApiService apiService) { InitializeComponent(); _geolocatorService = geolocatorService; _apiService = apiService; ShowParkAsync(); }
public MapPage(IGeolocatorService geolocatorService, IApiService apiService) { InitializeComponent(); _geolocatorService = geolocatorService; _apiService = apiService; MoveMapToCurrentPositionAsync(); ShowPropertiesAsync(); }
public MapsPage(IGeolocatorService geolocatorService, IApiService apiService, INavigationService navigationService) { InitializeComponent(); _geolocatorService = geolocatorService; _apiService = apiService; _navigationService = navigationService; }
/// <summary> /// Attempts to obtain the location and indicates whether this was successful. See <see cref="LocationResult"/> /// </summary> public static async Task <LocationResult> TryGetLocation(this IGeolocatorService locationService, CancellationToken ct) { try { return(new LocationResult(isSuccessful: true, location: await locationService.GetLocation(ct))); } catch (InvalidOperationException) { return(new LocationResult(isSuccessful: false, location: default));
/// <summary> /// Gets and observes the user's location (or null if it's unavailable). Requests the permission if this was not already done. /// The location becomes null as soon as the location permission is denied. /// </summary> public static IObservable <Geocoordinate> GetAndObserveLocationOrDefault(this IGeolocatorService service) { var initialLocationOrNull = Observable.Create <Geocoordinate>(service.GetInitialLocationOrDefault); var locationObservable = ObserveLocation(service); var locationUnavailableObservable = ObserveIsPermissionGranted(service) .Where(isGranted => !isGranted) .Select(_ => default(Geocoordinate)); return(Observable.Merge(initialLocationOrNull, locationObservable, locationUnavailableObservable)); }
public EndTripPageViewModel(INavigationService navigationService, IApiService apiService, IGeolocatorService geolocatorService) : base(navigationService) { _navigationService = navigationService; _apiService = apiService; _geolocatorService = geolocatorService; Title = Languages.EndTrip; IsEnabled = true; Comments = new ObservableCollection <Comment>(CombosHelper.GetComments()); }
public CustomGoogleMap(IGeolocatorService geolocatorService) { _geolocatorService = geolocatorService; //var location = new Position(30.4, -97.7); var location = _geolocatorService.LastRecordedPosition; var cf = CameraUpdateFactory.NewPositionZoom(location, 13.0); this.InitialCameraUpdate = cf; }
public MapasPage( IGeolocatorService geolocatorService, IApiService apiService) { InitializeComponent(); _geolocatorService = geolocatorService; _apiService = apiService; ShowOwnersAsync(); MoveMapToCurrentPositionAsync(); }
public CablesMapPage(IGeolocatorService geolocatorService) { InitializeComponent(); _geolocatorService = geolocatorService; MyMap.MapType = MapType.Street; MyMap.IsVisible = false; MoveMapToCurrentPositionAsync(); MyMap.IsVisible = true; ShowPinsAsync(); }
/// <summary> /// Gets the current location. Does not throw an <see cref="InvalidOperationException"/> when that location is unavailable /// (for instance, because of lacking permissions) but rather returns null. /// </summary> public static async Task <Geocoordinate> GetLocationOrDefault(this IGeolocatorService locationService, CancellationToken ct) { try { return(await locationService.GetLocation(ct)); } catch (InvalidOperationException) { return(null); } }
public MapPage(IGeolocatorService geolocatorService, IApiService apiService) { InitializeComponent(); mp.MapType = MapType.Street; ma2.Source = "satellite.png"; _geolocatorService = geolocatorService; _apiService = apiService; ShowPropertiesAsync(); MoveMapToCurrentPositionAsync(); }
public RegisterPageViewModel( INavigationService navigationService, IApiService apiService, IGeolocatorService geolocatorService) : base(navigationService) { _navigationService = navigationService; _apiService = apiService; _geolocatorService = geolocatorService; Title = "Register new user"; IsEnabled = true; }
public FindClosestPlacesCommand( IPlaces placesApi, IGeolocatorService geoLocator, ICategoriesService categoryService, CancellationToken cancellationToken) { this.categoryService = categoryService; this.cancellationToken = cancellationToken; this.geoLocator = geoLocator; this.placesApi = placesApi; }
public RegisterPageViewModel( INavigationService navigationService, IApiService apiService, IGeolocatorService geolocatorService) : base(navigationService) { Title = Languages.RegisterNewUser; IsEnabled = true; _navigationService = navigationService; _apiService = apiService; _geolocatorService = geolocatorService; }
public ReportPageViewModel(INavigationService navigationService, IGeolocatorService geolocatorService, IApiService apiService, IFilesHelper filesHelper) : base(navigationService) { _navigationService = navigationService; _geolocatorService = geolocatorService; _apiService = apiService; _filesHelper = filesHelper; ReportRequest = new ReportRequest(); Image = App.Current.Resources["UrlNoImage"].ToString(); Title = Languages.CreateReport; LoadSourceAsync(); }
public ProfilePageViewModel( INavigationService navigationService, IApiService apiService, IGeolocatorService geolocatorService) : base(navigationService) { Title = Languages.MyProfile; IsEnabled = true; Owner = JsonConvert.DeserializeObject <OwnerResponse>(Settings.Owner); _geolocatorService = geolocatorService; _navigationService = navigationService; _apiService = apiService; }
public ReportPageViewModel( INavigationService navigationService, IApiService apiService, IGeolocatorService geolocatorService) : base(navigationService) { Title = "Reporte un incidente"; IsEnabled = true; _navigationService = navigationService; _apiService = apiService; _geolocatorService = geolocatorService; }
public ReportPageViewModel( INavigationService navigationService, IApiService apiService, IGeolocatorService geolocatorService) : base(navigationService) { Title = Languages.ReportAnIncident; IsEnabled = true; _navigationService = navigationService; _apiService = apiService; _geolocatorService = geolocatorService; }
public RegisterViewModel(INavigationService navigationService, IApiService apiService, IGeolocatorService geolocatorService) : base(navigationService) { _navigationService = navigationService; _apiService = apiService; _geolocatorService = geolocatorService; Title = Languages.Register1; IsEnabled = true; LoadRoles(); }
public AddLocationPageViewModel( INavigationService navigationService, IApiService apiService, IGeolocatorService geolocatorService) : base(navigationService) { _navigationService = navigationService; _apiService = apiService; _geolocatorService = geolocatorService; Title = "Add Location"; IsEnabled = true; Location = new EstablishmentLocationRequest(); TypeEstablishments = new ObservableCollection <TypeEstablishmentResponse>(CombosHelper.GetTypeEstablishment()); Cities = new ObservableCollection <CityResponse>(CombosHelper.GetCities()); }
public StartTripPageViewModel(INavigationService navigationService, IGeolocatorService geolocatorService, IApiService apiService) : base(navigationService) { _navigationService = navigationService; _geolocatorService = geolocatorService; _apiService = apiService; Title = Languages.StartTrip; ButtonLabel = Languages.StartTrip; _tripDetailsRequest = new TripDetailsRequest { TripDetails = new List <TripDetailRequest>() }; IsEnabled = true; LoadSourceAsync(); }
//private readonly IDialogService _dialogService; public ZoneMapViewModel( ILayerService layerService, IGeolocatorService geolocatorService, INavigationService navigationService) //IDialogService dialogService) { _layerService = layerService; _geolocatorService = geolocatorService; _navigationService = navigationService; //_dialogService = dialogService; IsBusy = true; var cp = _geolocatorService.LastRecordedPosition; MapRegion = MapSpan.FromCenterAndRadius(cp, Distance.FromKilometers(1.2)); }
public RegisterPageViewModel( INavigationService navigationService, IRegexHelper regexHelper, IApiService apiService, IFilesHelper filesHelper, IGeolocatorService geolocatorService) : base(navigationService) { _navigationService = navigationService; _regexHelper = regexHelper; _apiService = apiService; _filesHelper = filesHelper; _geolocatorService = geolocatorService; Title = Languages.Register; Image = App.Current.Resources["UrlNoImage"].ToString(); IsEnabled = true; User = new UserRequest(); LoadCountriesAsync(); }