The code below works fine when compiled with VS2013 but when compiled with VS2015 gives the following error...
Uncaught Error: Type 'System.Runtime.CompilerServices.CallSite`1' has not been defined.
Code: Select all
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Shapes;
using Windows.UI.Xaml.Media;
namespace HTML5_Test
{
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
private void gpsButton_Click(object sender, RoutedEventArgs e)
{
GetLocation();
}
void GetLocation()
{
gMainPage = this;
CSHTML5.Interop.ExecuteJavaScript( @"navigator.geolocation.getCurrentPosition($0);", (Action<dynamic>)GpsReceived);
}
static MainPage gMainPage = null;
static void GpsReceived(dynamic position)
{
double glat = 0;
double glon = 0;
glat = (double)position.coords.latitude;
glon = (double)position.coords.longitude;
gMainPage.ShowLatLon(glat, glon);
}
public void ShowLatLon(double glat, double glon)
{
cLatitude.Text = "Lat: " + glat.ToString();
cLongitude.Text = "Lon: " + glon.ToString();
}
}
}