public static SettingsVal ReadSettings(HttpRequest request)
        {
            var settings = new SettingsVal();

            if (MobileUtils.IsMobileOrTablet())
            {
                settings.Theme    = DemoSettings.MobileDefaultTheme;
                settings.PopupMod = DemoSettings.MobileDefaultPopup;
            }

            if (request.Cookies[DemoSettings.CookieName] != null)
            {
                var vals = request.Cookies[DemoSettings.CookieName].Value.Split('|');
                if (vals.Length == 2)
                {
                    settings.Theme    = vals[0];
                    settings.PopupMod = vals[1];
                }
            }

            if (string.IsNullOrWhiteSpace(settings.Theme))
            {
                settings.Theme = DemoSettings.DefaultTheme;
            }

            if (string.IsNullOrWhiteSpace(settings.PopupMod))
            {
                settings.PopupMod = DemoSettings.DefaultPopup;
            }

            return(settings);
        }
Example #2
0
        public static SettingsVal ReadSettings(HttpRequest request)
        {
            var settings = new SettingsVal();

            if (MobileUtils.IsMobile())
            {
                settings.Theme = MobileDefaultTheme;
            }

            if (request.Cookies[CookieName] != null)
            {
                settings.Theme = request.Cookies[CookieName].Value;
            }

            if (string.IsNullOrWhiteSpace(settings.Theme))
            {
                settings.Theme = DefaultTheme;
            }

            return(settings);
        }