public override string ToString() { string retStr = Add.ToString(); if (LongLat != null) { retStr += " [ " + LongLat.ToString() + " ] "; } return(retStr); }
public GoogleMapAddress QueryGoogleForAddress(LongLat ll) { // if (Add == null) // throw new NullReferenceException("Invalid Address Object. Cannot Load LongLat"); GoogleMapAddress retVal; try { retVal = QueryLocalSourceForAddress(ll); } catch (Exception ex) { retVal = null; } if (retVal == null) { try { LocationDetailsQuery qr = QueryGoogleForLocation(ll.ToString()); if (qr.ErrorCode != null) { throw new Exception("Error Loading Location Details : " + qr.ErrorCode); } else if (qr.PCode == null) { throw new PostCodeNotFoundException("Post Code Not Found For (" + ll.Longatude + ", " + ll.Latatude + ")"); } else if (qr.Country == null) { throw new CountryNotFoundException("Country Not Found For (" + ll.Longatude + ", " + ll.Latatude + ")"); } retVal = new GoogleMapAddress(qr.PCode, qr.Country); } catch (Exception ex) { throw new Exception("Failed to get location details"); } } return(retVal); }