示例#1
0
        public static ThemeModel GetCurrent()
        {
            var themeViewModel = ThemesProvider.Load();

            if (themeViewModel == null || string.IsNullOrWhiteSpace(themeViewModel.SelectedTheme))
            {
                return(Default);
            }

            return(themeViewModel.ThemesList.FirstOrDefault(t => t.Title == themeViewModel.SelectedTheme) ?? Default);
        }
        public static IServiceCollection DefineBlazorousThemes(this IServiceCollection serviceCollection, Action <IThemes, ICssCreator> themes)
        {
            var sp         = serviceCollection.BuildServiceProvider();
            var cssCreator = (CssCreator)sp.GetRequiredService <ICssCreator>();

            IThemes themesProvider = new ThemesProvider(cssCreator);

            cssCreator.ThemeProvider = themesProvider;
            serviceCollection.AddSingleton <IThemes>(themesProvider);
            themes(themesProvider, cssCreator);
            return(serviceCollection);
        }
 public void PopulateItems()
 {
     Items = ThemesProvider.GetThemes();
 }
 protected void Page_Init(object sender, EventArgs e)
 {
     ASPxComboBox1.DataSource = ThemesProvider.GetThemes();
     ASPxComboBox1.DataBind();
 }