i had some trouvle with invoking a javascript function with more than one argument from a html page that is what i am doing :
wbNavigator.Navigate(new Uri("http://localhost:56433/route.html" ,UriKind.Absolute) );
object results= wbNavigator.InvokeScript("calculer", new string[] {"3.072526", "36.766942", "3.042526", "36.766942"});
but when invoking nothing’s hapening .Am i missing something ?
that is my javascript Code :
<script type="text/javascript">
var directionsService = new google.maps.DirectionsService();
var directionsDisplay = new google.maps.DirectionsRenderer();
var myOptions = {
zoom: 7,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
function calcluer(lon_A, lat_A, lon_B, lat_B) {
var map = new google.maps.Map(document.getElementById("map"), myOptions);
directionsDisplay.setMap(map);
var salle2 = new google.maps.LatLng(lat_A, lon_A);
var salle3 = new google.maps.LatLng(lat_B, lon_B);
var request = {
origin: salle2,
destination: salle3,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function (response, status) {
if (status == google.maps.DirectionsStatus.OK) {
// Display the distance:
document.getElementById('distance').innerHTML +=
response.routes[0].legs[0].distance.value + " meters";
// Display the duration:
document.getElementById('duration').innerHTML +=
response.routes[0].legs[0].duration.value + " seconds";
directionsDisplay.setDirections(response);
}
});
}
</script>
Just use:-
Note that doing this immediately after navigate may not have the desired effect. You should perhaps move this code to the
LoadCompletedevent of theWebBrowser.