Skip to content

Commit

Permalink
Reuse the theme switcher brush converter
Browse files Browse the repository at this point in the history
  • Loading branch information
ScrubN committed Oct 15, 2023
1 parent 193b0ca commit 23f2615
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion TwitchDownloaderWPF/Services/ThemeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,13 @@ private void ChangeThemePath(string newTheme)
var xmlReader = new XmlSerializer(typeof(ThemeResourceDictionaryModel));
using var streamReader = new StreamReader(themeFile);
var themeValues = (ThemeResourceDictionaryModel)xmlReader.Deserialize(streamReader)!;
var brushConverter = new BrushConverter();

foreach (var solidBrush in themeValues.SolidColorBrush)
{
try
{
_wpfApplication.Resources[solidBrush.Key] = (SolidColorBrush)new BrushConverter().ConvertFrom(solidBrush.Color);
_wpfApplication.Resources[solidBrush.Key] = (SolidColorBrush)brushConverter.ConvertFrom(solidBrush.Color);
}
catch (FormatException) { }
}
Expand Down

0 comments on commit 23f2615

Please sign in to comment.