ThemeService Improvements

Centralized the code used to determine the available themes, panes, and containers.  This isn't the most "ideal" way to handle this.  However, it does improve the management of the code by centralizing the logic for theme selection.

Future PR's development might improve this more.
This commit is contained in:
Mitchel Sellers
2019-05-17 23:30:08 -05:00
parent 1e5df43e84
commit 86adae19c1
8 changed files with 64 additions and 62 deletions

View File

@ -136,17 +136,8 @@
protected override async Task OnInitAsync()
{
List<Theme> Themes = await ThemeService.GetThemesAsync();
foreach (Theme theme in Themes)
{
foreach (string themeControl in theme.ThemeControls.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{
themes.Add(themeControl, theme.Name + " - " + @Utilities.GetTypeNameClass(themeControl));
}
foreach (string panelayout in theme.PaneLayouts.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{
panelayouts.Add(panelayout, theme.Name + " - " + @Utilities.GetTypeNameClass(panelayout));
}
}
themes = ThemeService.CalculateSelectableThemes(Themes);
panelayouts = ThemeService.CalculateSelectablePaneLayouts(Themes);
PageId = Int32.Parse(PageState.QueryString["id"]);
Page p = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault();