private void HandleGpsEvent(GpsEvent gpsEvent) { if (gpsEvent == null) { return; } if (GoogleSkyWebBrowser.InvokeRequired) { GoogleSkyWebBrowser.Invoke(new Action(() => HandleGpsEvent(gpsEvent))); return; } GoogleSkyCoordinate = new GoogleSkyCs(gpsEvent.Latitude, gpsEvent.Longitude); LogListBox("Got GPS coordinates \n Latitiude:{0} \n Longitude:{1}", GoogleSkyCoordinate.Latitude, GoogleSkyCoordinate.Longitude); var scriptArguements = new object[] { GoogleSkyCoordinate.Latitude, GoogleSkyCoordinate.Longitude, DefaultRange }; try { if (GoogleSkyWebBrowser.Document != null) { GoogleSkyWebBrowser.Document.InvokeScript("updateGoogleSkyCoordinates", scriptArguements); } } catch { UpdateGoogleSkyErrorUi("Unable to update sky coordinates"); } }
private void HandleOrientationEvent(OrientationEvent orientationEvent) { if (orientationEvent == null) { return; } if (GoogleSkyWebBrowser.InvokeRequired) { GoogleSkyWebBrowser.Invoke(new Action(() => HandleOrientationEvent(orientationEvent))); return; } GoogleSkyCoordinate = orientationEvent.Orientation; LogListBox("Update Google Sky coordinates \n Latitiude:{0} \n Longitude:{1}", GoogleSkyCoordinate.Latitude, GoogleSkyCoordinate.Longitude); GoogleSkyWebBrowser.Document.InvokeScript("updateGoogleSkyCoordinates", new object[] { new object[] { GoogleSkyCoordinate.Latitude, GoogleSkyCoordinate.Longitude, DefaultRange } }); }