public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { LocationCoordinates coords = (LocationCoordinates)value; if (coords == null) { return("unknown location"); } if (Geolocator.LastKnownLocation == null) { return(coords.ToString()); } double distance = Geolocator.LastKnownLocation .DistanceTo(coords, DistanceUnits.Miles); // TODO: this should be randomized a bit // so that people can't easily find the location of // an item by checking the distance over and over. return($"{Math.Round(distance, 3)} miles away"); }
Uri GetMapsUri(LocationCoordinates coords) { return(GetMapsUri(coords.ToString())); }