Xamrin.Forms (PCL) 带有位置(纬度和经度)的 WebView

Xamrin.Forms (PCL) WebView with Location (latitude and longitude)

我已经使用 DependencyService 获取自定义位置 class,其中包含经度、纬度等。这是 class:

public class CurrentLocation
{
    public double Latitude { get; set; }
    public double Longitude { get; set; }
    public double Altitude { get; set; }
    public float Accuracy { get; set; }
}

但我不明白如何将此值传递给 WebView

中的任何 URL

创建 WebView 时,您可以将其 Source 属性 设置为 URL。例如,在您的内容页面的构造函数中,

var webview = new WebView() { Source = "http://example.com?lat=" + lat + "&lng=" + lng };
this.Content = webview;