Add font size theme support & improve theme system
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user