public JavaScriptResult LegacyTreeJs()
        {
            Func <string> getResult = () =>
            {
                var javascript = new StringBuilder();
                javascript.AppendLine(LegacyTreeJavascript.GetLegacyTreeJavascript());
                javascript.AppendLine(LegacyTreeJavascript.GetLegacyIActionJavascript());
                //add all of the menu blocks
                foreach (var file in GetLegacyActionJs(LegacyJsActionType.JsBlock))
                {
                    javascript.AppendLine(file);
                }
                return(javascript.ToString());
            };

            //cache the result if debugging is disabled
            var result = HttpContext.IsDebuggingEnabled
                ? getResult()
                : ApplicationContext.ApplicationCache.RuntimeCache.GetCacheItem <string>(
                typeof(BackOfficeController) + "LegacyTreeJs",
                () => getResult(),
                new TimeSpan(0, 10, 0));

            return(JavaScript(result));
        }
示例#2
0
 /// <summary>
 /// Returns a string with javascript proxy methods for IActions that are using old javascript
 /// </summary>
 /// <returns></returns>
 public string GetLegacyIActionJavascript()
 {
     return(LegacyTreeJavascript.GetLegacyIActionJavascript());
 }