#pragma warning disable 1591 //------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.239 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace Microsoft.Web.Helpers { using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Web; using System.Web.Helpers; using System.Web.Security; using System.Web.UI; using System.Web.WebPages; using System.Web.WebPages.Html; using System.Diagnostics; using System.Web.WebPages.Scope; using System.Web.UI.WebControls; using System.Globalization; using Microsoft.Internal.Web.Utils; [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorSingleFileGenerator", "0.6.0.0")] public class Maps : System.Web.WebPages.HelperPage { #line hidden private const string DefaultWidth = "300px"; private const string DefaultHeight = "300px"; private static readonly object _mapIdKey = new object(); private static readonly object _mapQuestApiKey = new object(); private static readonly object _bingApiKey = new object(); private static readonly object _yahooApiKey = new object(); public static string MapQuestApiKey { get { return (string)ScopeStorage.CurrentScope[_mapQuestApiKey]; } set { ScopeStorage.CurrentScope[_mapQuestApiKey] = value; } } public static string YahooApiKey { get { return (string)ScopeStorage.CurrentScope[_yahooApiKey]; } set { ScopeStorage.CurrentScope[_yahooApiKey] = value; } } public static string BingApiKey { get { return (string)ScopeStorage.CurrentScope[_bingApiKey]; } set { ScopeStorage.CurrentScope[_bingApiKey] = value; } } private static int MapId { get { var value = (int?)HttpContext.Current.Items[_mapIdKey]; return value ?? 0; } set { HttpContext.Current.Items[_mapIdKey] = value; } } private static string GetMapElementId() { return "map_" + MapId; } private static string TryParseUnit(string value, string defaultValue) { if (String.IsNullOrEmpty(value)) { return defaultValue; } try { return Unit.Parse(value, CultureInfo.InvariantCulture).ToString(CultureInfo.InvariantCulture); } catch (ArgumentException) { return defaultValue; } } private static IHtmlString RawJS(string text) { return Raw(HttpUtility.JavaScriptStringEncode(text)); } private static IHtmlString Raw(string text) { return new HtmlString(text); } private static string GetApiKey(string apiKey, object scopeStorageKey) { if (apiKey.IsEmpty()) { return (string)ScopeStorage.CurrentScope[scopeStorageKey]; } return apiKey; } public class MapLocation { private readonly string _latitude; private readonly string _longitude; public MapLocation(string latitude, string longitude) { _latitude = latitude; _longitude = longitude; } public string Latitude { get { return _latitude; } } public string Longitude { get { return _longitude; } } } internal static string GetDirectionsQuery(string location, string latitude, string longitude, Func encoder = null) { encoder = encoder ?? HttpUtility.UrlEncode; Debug.Assert(!(location.IsEmpty() && latitude.IsEmpty() && longitude.IsEmpty())); if (location.IsEmpty()) { return encoder(latitude + "," + longitude); } return encoder(location); } #line hidden public static System.Web.WebPages.HelperResult GetMapQuestHtml(string key = null, string location = null, string latitude = null, string longitude = null, string width = "300px", string height = "300px", int zoom = 7, string type = "map", bool showDirectionsLink = true, string directionsLinkText = "Get Directions", bool showZoomControl = true, IEnumerable pushpins = null) { return new System.Web.WebPages.HelperResult(__razor_helper_writer => { key = GetApiKey(key, _mapQuestApiKey); if (key.IsEmpty()) { throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "key"); } string mapElement = GetMapElementId(); string loc = "null"; // We want to print the value 'null' in the client if (latitude != null && longitude != null) { loc = String.Format(CultureInfo.InvariantCulture, "{{lat: {0}, lng: {1}}}", HttpUtility.JavaScriptStringEncode(latitude, addDoubleQuotes: false), HttpUtility.JavaScriptStringEncode(longitude, addDoubleQuotes: false)); } // The MapQuest key listed on their website is Url encoded to begin with. WriteLiteralTo(@__razor_helper_writer, " \r\n"); WriteLiteralTo(@__razor_helper_writer, " \r\n"); WriteLiteralTo(@__razor_helper_writer, "
\r\n
\r\n"); if (showDirectionsLink) { WriteLiteralTo(@__razor_helper_writer, " "); WriteTo(@__razor_helper_writer, directionsLinkText); WriteLiteralTo(@__razor_helper_writer, "\r\n"); } MapId++; }); } #line hidden public static System.Web.WebPages.HelperResult GetBingHtml(string key = null, string location = null, string latitude = null, string longitude = null, string width = null, string height = null, int zoom = 14, string type = "auto", bool showDirectionsLink = true, string directionsLinkText = "Get Directions", IEnumerable pushpins = null) { return new System.Web.WebPages.HelperResult(__razor_helper_writer => { key = GetApiKey(key, _bingApiKey); if (key.IsEmpty()) { throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "key"); } string mapElement = GetMapElementId(); type = (type ?? "auto").ToLowerInvariant(); WriteLiteralTo(@__razor_helper_writer, " \r\n"); WriteLiteralTo(@__razor_helper_writer, " \r\n"); WriteLiteralTo(@__razor_helper_writer, "
\r\n
\r\n"); if (showDirectionsLink) { // Review: Need to figure out if the link needs to be localized. WriteLiteralTo(@__razor_helper_writer, " "); WriteTo(@__razor_helper_writer, directionsLinkText); WriteLiteralTo(@__razor_helper_writer, "\r\n"); } MapId++; }); } #line hidden public static System.Web.WebPages.HelperResult GetGoogleHtml(string location = null, string latitude = null, string longitude = null, string width = null, string height = null, int zoom = 14, string type = "ROADMAP", bool showDirectionsLink = true, string directionsLinkText = "Get Directions", IEnumerable pushpins = null) { return new System.Web.WebPages.HelperResult(__razor_helper_writer => { string mapElement = GetMapElementId(); type = (type ?? "ROADMAP").ToUpperInvariant(); // Map types are in upper case // Google maps does not support null centers. We'll set it to arbitrary values if they are null and only the location is provided. // These locations are somewhere around Microsoft's Redmond Campus. latitude = latitude ?? "47.652437"; longitude = longitude ?? "-122.132424"; WriteLiteralTo(@__razor_helper_writer, " \r\n"); WriteLiteralTo(@__razor_helper_writer, " \r\n"); WriteLiteralTo(@__razor_helper_writer, "
\r\n
\r\n"); if (showDirectionsLink) { WriteLiteralTo(@__razor_helper_writer, " "); WriteTo(@__razor_helper_writer, directionsLinkText); WriteLiteralTo(@__razor_helper_writer, "\r\n"); } MapId++; }); } #line hidden public static System.Web.WebPages.HelperResult GetYahooHtml(string key = null, string location = null, string latitude = null, string longitude = null, string width = null, string height = null, int zoom = 4, string type = "YAHOO_MAP_REG", bool showDirectionsLink = true, string directionsLinkText = "Get Directions", IEnumerable pushpins = null) { return new System.Web.WebPages.HelperResult(__razor_helper_writer => { key = GetApiKey(key, _yahooApiKey); if (key.IsEmpty()) { throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "key"); } string mapElement = GetMapElementId(); WriteLiteralTo(@__razor_helper_writer, " \r\n"); WriteLiteralTo(@__razor_helper_writer, " \r\n"); WriteLiteralTo(@__razor_helper_writer, "
\r\n
\r\n"); if (showDirectionsLink) { WriteLiteralTo(@__razor_helper_writer, " "); WriteTo(@__razor_helper_writer, directionsLinkText); WriteLiteralTo(@__razor_helper_writer, "\r\n"); } MapId++; }); } public Maps() { } protected static System.Web.HttpApplication ApplicationInstance { get { return ((System.Web.HttpApplication)(Context.ApplicationInstance)); } } } } #pragma warning restore 1591