How to pass information from a WPF app to an HTML page

181 views
0

I got a WPF application which finds locations of latitude and longitude, and display them to the user inside the app. The app got a button that when clicked, is supposed to open a map using the Google maps API and display these locations on the map using markers.

I got this below script inside an HTML which as of now just opens a map on a fixed location and displaying just a sample marker.

<script>
  function initMap() {
    let myLatLng = {lat: -25.363, lng: 131.044};

    let map = new google.maps.Map(document.getElementById('map'), {
      zoom: 4,
      center: myLatLng
    });

    let marker = new google.maps.Marker({
      position: myLatLng,
      map: map,
      title: 'TITLE!'
    });
  }
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=<myKey>&callback=initMap">
</script>

So I know that in order to open the page itself all I need to do is:

System.Diagnostics.Process.Start(pathToHtmlFile);

but how exactly can I pass the locations I find in the WPF side to the JS initMap function?