public SimpleThemeInfoProvider(string themeName)
 {
     this._themeInfoResult = new ThemeInfoResult
     {
         DefaultTheme = themeName,
         RequestTheme = themeName
     };
 }
        public void PopulateValues(ViewLocationExpanderContext context)
        {
            ThemeInfoResult result = this._themeInfoProvider
                                     .GetThemeInfoResultAsync()
                                     .Result;

            context.Values["ThemeName"] = result.ThemeName;
        }
Пример #3
0
        public void PopulateValues(ViewLocationExpanderContext context)
        {
            ThemeInfoResult result = this._themeInfoProvider
                                     .DetermineThemeInfoResult(context.ActionContext.HttpContext)
                                     .Result;

            context.Values["requestTheme"] = result.RequestTheme;
            context.Values["defaultTheme"] = result.DefaultTheme;
        }
Пример #4
0
        public Task <ThemeInfoResult> DetermineThemeInfoResult(
            HttpContext httpContext)
        {
            var result = new ThemeInfoResult
            {
                RequestTheme = httpContext.Request.Query["theme"],
                DefaultTheme = this._defaultTheme
            };

            // TODO: check if plugin exists
            // TODO: check if plugin is a theme

            if (string.IsNullOrWhiteSpace(result.RequestTheme))
            {
                result.RequestTheme = result.DefaultTheme;
            }

            return(Task.FromResult(result));
        }