Esempio n. 1
0
        public static void Add(string key, object value, RequireJsOptionsScope scope = RequireJsOptionsScope.Page)
        {
            switch (scope)
            {
            case RequireJsOptionsScope.Page:
                var pageOptions = GetPageOptions();
                if (pageOptions.Keys.Contains(key))
                {
                    pageOptions.Remove(key);
                }

                pageOptions.Add(key, value);
                break;

            case RequireJsOptionsScope.Global:
                var globalOptions = GetGlobalOptions();
                if (globalOptions.Keys.Contains(key))
                {
                    globalOptions.Remove(key);
                }

                globalOptions.Add(key, value);
                break;
            }
        }
        public void Add(string key, Dictionary <string, object> value, RequireJsOptionsScope scope = RequireJsOptionsScope.Page, bool clearExisting = false)
        {
            var dictToModify = new Dictionary <string, object>();

            switch (scope)
            {
            case RequireJsOptionsScope.Page:
                dictToModify = pageOptions;
                break;

            case RequireJsOptionsScope.Global:
                dictToModify = globalOptions;
                break;
            }

            var existing = dictToModify.FirstOrDefault(r => r.Key == key).Value;

            if (existing != null)
            {
                if (!clearExisting && existing is Dictionary <string, object> )
                {
                    AppendItems(existing as Dictionary <string, object>, value);
                }
                else
                {
                    dictToModify.Remove(key);
                    dictToModify.Add(key, value);
                }
            }
            else
            {
                dictToModify.Add(key, value);
            }
        }
        public void Add(string key, Dictionary<string, object> value, RequireJsOptionsScope scope = RequireJsOptionsScope.Page, bool clearExisting = false)
        {
            var dictToModify = new Dictionary<string, object>();
            switch (scope)
            {
                case RequireJsOptionsScope.Page:
                    dictToModify = pageOptions;
                    break;
                case RequireJsOptionsScope.Global:
                    dictToModify = globalOptions;
                    break;
            }

            var existing = dictToModify.FirstOrDefault(r => r.Key == key).Value;
            if (existing != null)
            {
                if (!clearExisting && existing is Dictionary<string, object>)
                {
                    AppendItems(existing as Dictionary<string, object>, value);
                }
                else
                {
                    dictToModify.Remove(key);
                    dictToModify.Add(key, value);
                }
            }
            else
            {
                dictToModify.Add(key, value);
            }
        }
Esempio n. 4
0
        public static void Clear(RequireJsOptionsScope scope)
        {
            switch (scope)
            {
            case RequireJsOptionsScope.Page:
                GetPageOptions().Clear();
                break;

            case RequireJsOptionsScope.Global:
                GetGlobalOptions().Clear();
                break;
            }
        }
        public void Clear(RequireJsOptionsScope scope)
        {
            switch (scope)
            {
            case RequireJsOptionsScope.Page:
                pageOptions.Clear();
                break;

            case RequireJsOptionsScope.Global:
                globalOptions.Clear();
                break;
            }
        }
        public void Save(RequireJsOptionsScope scope)
        {
            // sends options to view using the ViewBag
            switch (scope)
            {
            case RequireJsOptionsScope.Page:
                controller.ViewBag.PageOptions = pageOptions;
                break;

            case RequireJsOptionsScope.Global:
                controller.ViewBag.GlobalOptions = globalOptions;
                break;
            }
        }
 public void Add(string key, object value, RequireJsOptionsScope scope = RequireJsOptionsScope.Page)
 {
     switch (scope)
     {
         case RequireJsOptionsScope.Page:
             if (pageOptions.Keys.Contains(key))
             {
                 pageOptions.Remove(key);
             }
             pageOptions.Add(key, value);
             break;
         case RequireJsOptionsScope.Global:
             if (globalOptions.Keys.Contains(key))
             {
                 globalOptions.Remove(key);
             }
             globalOptions.Add(key, value);
             break;
     }
 }
Esempio n. 8
0
 public static object GetByKey(string key, RequireJsOptionsScope scope)
 {
     return(scope == RequireJsOptionsScope.Page ? GetPageOptions().FirstOrDefault(r => r.Key == key)
                                                : GetGlobalOptions().FirstOrDefault(r => r.Key == key));
 }
Esempio n. 9
0
 public static void Clear(RequireJsOptionsScope scope)
 {
     switch (scope)
     {
         case RequireJsOptionsScope.Page:
             GetPageOptions().Clear();
             break;
         case RequireJsOptionsScope.Global:
             GetGlobalOptions().Clear();
             break;
     }
 }
Esempio n. 10
0
 public static object GetByKey(string key, RequireJsOptionsScope scope)
 {
     return scope == RequireJsOptionsScope.Page ? GetPageOptions().FirstOrDefault(r => r.Key == key)
                                                : GetGlobalOptions().FirstOrDefault(r => r.Key == key);
 }
 public void Save(RequireJsOptionsScope scope)
 {
     //sends options to view using the ViewBag
     switch (scope)
     {
         case RequireJsOptionsScope.Page:
             controller.ViewBag.PageOptions = pageOptions;
             break;
         case RequireJsOptionsScope.Global:
             controller.ViewBag.GlobalOptions = globalOptions;
             break;
     }
 }
 public void Clear(RequireJsOptionsScope scope)
 {
     switch (scope)
     {
         case RequireJsOptionsScope.Page:
             pageOptions.Clear();
             break;
         case RequireJsOptionsScope.Global:
             globalOptions.Clear();
             break;
     }
 }