public void TestFormatMyPositionShareText() { // set up var mapPoint = new MapPoint(47.6764385, 11.8710533, 1685.0); // run string text = DataFormatter.FormatMyPositionShareText(mapPoint, DateTimeOffset.UtcNow); // check Assert.IsTrue(text.Length > 0, "formatted text must not be empty"); }
/// <summary> /// Called when toolbar button "Share" was clicked /// </summary> /// <returns>task to wait on</returns> private async Task OnClicked_ToolbarButtonSharePosition() { var position = await this.geolocationService.GetPositionAsync(timeout : TimeSpan.FromSeconds(0.1)); if (position != null) { var point = new MapPoint(position.Latitude, position.Longitude, position.Altitude); await App.ShareMessageAsync( "Share my position with...", DataFormatter.FormatMyPositionShareText(point, position.Timestamp)); } }
/// <summary> /// Called when the user clicked on the "Share position" link in the "my position" pin description. /// </summary> /// <returns>task to wait on</returns> private async Task OnMapView_ShareMyLocation() { var position = await this.geolocator.GetPositionAsync(timeout : TimeSpan.FromSeconds(0.1), includeHeading : false); if (position != null) { var point = new MapPoint(position.Latitude, position.Longitude, position.Altitude); await this.UpdateLastShownPositionAsync(point); await App.ShareMessageAsync( "Share my position with...", DataFormatter.FormatMyPositionShareText(point, position.Timestamp)); } }