private string CreateMapViewScript() { string source = null; StringBuilder sb = new StringBuilder(); var apiKey = GoogleMaps.GetKey(); sb.Append(HtmlStyle); sb.AppendLine(); sb.Append("<script src=\""); sb.Append(GoogleMapURL); sb.Append("js?key="); sb.Append(apiKey); sb.Append("\"></script>"); sb.AppendLine(); sb = CreateMapOptionScript(sb); sb.AppendLine(); sb.Append("function initialize(){\n var map = new google.maps.Map(document.getElementById(\"map\"), mapProp); "); if (Element.Markers.Count > 0) { sb = CreatePinsScript(sb); } sb.Append("\n}\ngoogle.maps.event.addDomListener(window, \'load\', initialize);\n"); sb.Append("</script></head><body><div id =\"map\"></div></body></html>"); source = sb.ToString(); return(source); }
public static void Init(string apiKey) { if (!string.IsNullOrEmpty(apiKey)) { GoogleMaps.Init(apiKey); } else { Debug.Assert(!string.IsNullOrEmpty(apiKey), "apiKey is null or empty!"); } Init(); }