Add font size theme support & improve theme system

This commit is contained in:
azakhi
2018-08-25 15:52:16 +03:00
parent 8ba3433dcf
commit bc5a005ee7
26 changed files with 247 additions and 70 deletions

View File

@@ -42,6 +42,9 @@ namespace Filtration.ThemeEditor.Services
case ThemeComponentType.BorderColor:
mismatchedComponents = ApplyColorTheme(blocks, typeof(BorderColorBlockItem), component);
break;
case ThemeComponentType.FontSize:
mismatchedComponents = ApplyIntegerTheme(blocks, typeof(FontSizeBlockItem), component);
break;
}
}
@@ -72,5 +75,25 @@ namespace Filtration.ThemeEditor.Services
return !componentMatched;
}
private bool ApplyIntegerTheme(IEnumerable<ItemFilterBlock> blocks, Type type, ThemeComponent component)
{
var componentMatched = false;
foreach (var block in blocks)
{
foreach (var blockItem in block.BlockItems.Where(i => i.GetType() == type))
{
var colorBlockItem = (IntegerBlockItem)blockItem;
if (colorBlockItem.ThemeComponent != null &&
colorBlockItem.ThemeComponent.ComponentName == component.ComponentName)
{
colorBlockItem.Value = ((IntegerThemeComponent)component).Value;
componentMatched = true;
}
}
}
return !componentMatched;
}
}
}