public static double CalculateQiblah(GeoCoder g, Placemark p) { double result = double.NaN; if (g.StatusCode != GeoErrors.G_GEO_SUCCESS) { throw new ApplicationException("Cannot located Qiblah for your location."); } else { DotFermion.Qiblah.QiblahCalculator calc = new DotFermion.Qiblah.QiblahCalculator(p.Latitude, p.Longitude); result = calc.Qiblah; } return result; }
public static double CalculateQiblah(GeoCoder geoCoder) { double result = double.NaN; if (geoCoder.StatusCode != 200) { throw new ApplicationException("Address not found"); } else { DotFermion.Qiblah.QiblahCalculator calc = new DotFermion.Qiblah.QiblahCalculator(geoCoder.Latitude, geoCoder.Longitude); result = calc.Qiblah; } return result; }
private void btnQuery_Click(object sender, EventArgs e) { GeoCoder geoCoder = new GeoCoder(Properties.Settings.Default.GoogleMapsApiKey); geoCoder.Address = txtQuery.Text; geoCoder.SensorUsed = false; List<Placemark> placemarks = geoCoder.FetchExtendedGeoCodeData(); DotFermion.LibCache.LocationCacheRecord cacheRecord = new DotFermion.LibCache.LocationCacheRecord() { Query = txtQuery.Text, Placemarks = placemarks }; IMOS.Add(cacheRecord); lstResults.Items.Clear(); foreach (var placemark in placemarks) { lstResults.Items.Add(placemark.Address); } }