Exemplo n.º 1
0
        public void InitializeTranslator()
        {
            translator = new JavaScriptExpressionTranslator();

            CreateDateParseLocale();
            CreateDateLocaleFormat();

            CreateNumberLocaleFormat();
        }
Exemplo n.º 2
0
        static ExoWeb()
        {
            // Create the javascript translator
            ExpressionTranslator = new JavaScriptExpressionTranslator();

            // Cache the .NET 4.0 method info to create HTML strings when using MVC
            Assembly assembly = null;

            try
            {
                assembly = Assembly.Load("System.Web.Mvc");
            }
            catch (Exception e)
            {
                // If unable to load MVC properly, keep going.
            }

            if (assembly != null)
            {
                var type = assembly.GetType("System.Web.Mvc.MvcHtmlString");
                if (type != null)
                {
                    createHtmlString = type.GetMethod("Create", BindingFlags.Static | BindingFlags.Public, null, new Type[] { typeof(string) }, null);
                }
            }

            // Initialize the default implementation of the cache hash provider
            CacheHashProvider = () =>
            {
                if (cacheHash == null)
                {
                    int code = 0;

                    foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
                    {
                        code = code == 0 ? a.GetHashCode() : code ^ a.GetHashCode();
                    }

                    cacheHash = code.ToString();
                }
                return(cacheHash);
            };

            // Enable server rendering by default
            EnableServerRendering = true;
        }
Exemplo n.º 3
0
 public void Cleanup()
 {
     translator = null;
 }