refactor<*>: use DynamicResource instead of StaticResource for brushes and locales

This commit is contained in:
leo 2021-07-20 16:26:10 +08:00
parent 4a56b47265
commit afc4eafb6f
73 changed files with 630 additions and 601 deletions

View file

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
namespace SourceGit.Models {
@ -18,5 +19,15 @@ namespace SourceGit.Models {
Name = name;
Resource = res;
}
public static void Change() {
var lang = Preference.Instance.General.Locale;
foreach (var rs in App.Current.Resources.MergedDictionaries) {
if (rs.Source != null && rs.Source.OriginalString.StartsWith("pack://application:,,,/Resources/Locales/", StringComparison.Ordinal)) {
rs.Source = new Uri($"pack://application:,,,/Resources/Locales/{lang}.xaml", UriKind.Absolute);
break;
}
}
}
}
}