Example #1
0
        public ThemeProvider(IOptionsMonitor <ThemeOptions> options,
                             IThemeConfigStore themeConfigStore)
        {
            DefaultTheme = options.CurrentValue.DefaultTheme;
            _themeItems  = new List <ThemeItem>();
            if (options.CurrentValue.Themes != null)
            {
                _themeItems.AddRange(options.CurrentValue.Themes);
            }
            int tryCount       = 0;
            List <ThemeItem> t = null;

            do
            {
                try
                {
                    t = themeConfigStore.GetThemes();
                }
                catch (Exception)
                {
                }
                if (t != null)
                {
                    break;
                }
                tryCount++;
            } while (tryCount < 3);

            if (t != null && t.Count > 0)
            {
                _themeItems.AddRange(t);
            }

            if (options.CurrentValue.Themes != null && options.CurrentValue.Themes.Count > 0)
            {
                _themeItems.AddRange(t);
            }

            keyTheme = new ConcurrentDictionary <string, ThemeItem>();
        }
Example #2
0
 public ThemeProvider(IOptionsMonitor <ThemeConfiguration> options, IThemeConfigStore themeConfigStore)
 {
     _themeConfiguration = options.CurrentValue;
     _themeConfigStore   = themeConfigStore;
     keyTheme            = new ConcurrentDictionary <string, ThemeItem>();
 }